Skip to content

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

Merged
merged 1 commit into from
Oct 27, 2022
Merged

fix: disable minimal mode for API routes #1727

merged 1 commit into from
Oct 27, 2022

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Oct 27, 2022

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

  1. Visit /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

capy and kitten

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@ascorbic ascorbic requested a review from a team October 27, 2022 15:25
@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/635aa2e0f44f6a000851b726
😎 Deploy Preview https://deploy-preview-1727--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/635aa2e009548e00080bbc0f
😎 Deploy Preview https://deploy-preview-1727--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/635aa2e0c6830f00088f554b
😎 Deploy Preview https://deploy-preview-1727--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: bug code to address defects in shipped code label Oct 27, 2022
@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/635aa2e07114ec000890d8da
😎 Deploy Preview https://deploy-preview-1727--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/635aa2e0fff2530009f3fa92
😎 Deploy Preview https://deploy-preview-1727--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/635aa2e09447b6000a2a10ab
😎 Deploy Preview https://deploy-preview-1727--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/635aa2e0be79920008a2f12f
😎 Deploy Preview https://deploy-preview-1727--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/635aa2e0cab6a400096e1405
😎 Deploy Preview https://deploy-preview-1727--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit 0c2f2f6
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/635aa2e0d0f8960008683543
😎 Deploy Preview https://deploy-preview-1727--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link

@nickytonline nickytonline left a 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

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?

Copy link
Contributor Author

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.

@kodiakhq kodiakhq bot merged commit da8f440 into main Oct 27, 2022
@kodiakhq kodiakhq bot deleted the mk/api-unminimal branch October 27, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Custom Headers broken with 4.27.0
2 participants