-
Notifications
You must be signed in to change notification settings - Fork 89
fix: disable minimal mode for API routes #1727
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
Conversation
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
Approving but had a question now that it's turned off.
@@ -66,8 +66,6 @@ const makeHandler = (conf: NextConfig, app, pageRoot, page) => { | |||
|
|||
const NextServer: NextServerType = getNextServer() | |||
const nextServer = new NextServer({ | |||
// We know we're just an API route, so can enable minimal mode |
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.
What was the reasoning for enabling it originally? From what I've read, it's experimental and not recommended to be turned on. See vercel/next.js#29801. Also, it looks like it's meant for the Edge only?
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.
That's a lie. It's used by any site deployed to Vercel. It disables various features, such as on-disk caching that don't work in lambdas. It also disables lots of things that Vercel does at the edge instead. I turned it on so it didn't need to do routing (which we didn't need because it was one route per function). However the thing I missed is that it also disabled custom headers.
Summary
We had previously enabled minimal mode for API routes, because we didn't need routing. However this also disabled custom headers. This PR enables it and adds an e2e test.
Test plan
/api/hello
in the default demo and check for'x-custom-api-header': 'my custom api header value'
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Fixes #1712
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was published correctly.