-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: middleware #228
base: main
Are you sure you want to change the base?
feat: middleware #228
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
random request: could the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, but I have couple of points.
- Its missing documentation on how to use it.
- Perhaps now we can get deprecated usage of
NEXT_PUBLIC_AXIOM_TOKEN
and update the docs to mentionAXIOM_TOKEN
instead. - There is now a custom endpoint added by @c-ehrlich, not sure if we need to handle anything related to that or the config takes care of it.
const webVitalsEndpoint = axiomConfig.getIngestURL(EndpointType.webVitals); | ||
const logsEndpoint = axiomConfig.getIngestURL(EndpointType.logs); | ||
|
||
const headers = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our fetch sends a special UserAgent header to identify which SKS is sending the request. Its missing in here. Perhaps you can just proxy the request headers and adds the token on top of?
); | ||
|
||
// Return a 204 to the client | ||
return new NextResponse(null, { status: 204 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't status be returned as error if the request fails? Users might not notice if it always returns 204 even if it fails.
this adds middleware that will allow users to proxy their logs and webvital reports to their backend avoiding the need to provide their Axiom token and dataset to the frontend.