Skip to content

fix: guard split api routes behaviour by next version #2125

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 6 commits into from
May 22, 2023

Conversation

Skn0tt
Copy link
Contributor

@Skn0tt Skn0tt commented May 17, 2023

Description

We discovered that the Split-API-Routes behaviour introduced in #2058 depends on Next.js v12+. Because our Next Runtime needs to support everything from v10 up, I'm adding an additional guard that ensures versions sub v12 continue to use the current behaviour.

Documentation

Tests

You can test this change yourself like so:

  1. TODO

Relevant links (GitHub issues, etc.) or a picture of cute animal

@Skn0tt Skn0tt requested a review from a team as a code owner May 17, 2023 11:29
@netlify
Copy link

netlify bot commented May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/646b113012d8dd000899bedf
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/646b113060ad06000867040c
😎 Deploy Preview https://deploy-preview-2125--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.

@netlify
Copy link

netlify bot commented May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/646b11306ef91d0007478c08
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/646b11304f63070008f0dacd
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/646b11306ef91d0007478bfe
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/646b11306ef91d0007478c03
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/646b11300f48da00079df166
😎 Deploy Preview https://deploy-preview-2125--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.

@netlify
Copy link

netlify bot commented May 17, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/646b1130bf4d1d00084bca17
😎 Deploy Preview https://deploy-preview-2125--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 May 17, 2023

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

Name Link
🔨 Latest commit 683ea8e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/646b11307afc3f0008959103
😎 Deploy Preview https://deploy-preview-2125--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.

@github-actions github-actions bot added the type: bug code to address defects in shipped code label May 17, 2023
* Disabled by default. Can be overriden using the NEXT_SPLIT_API_ROUTES env var.
*/
export const splitApiRoutes = (featureFlags: Record<string, unknown>): boolean =>
destr(process.env.NEXT_SPLIT_API_ROUTES) ?? featureFlags.next_split_api_routes ?? false
export const splitApiRoutes = (featureFlags: Record<string, unknown>, publish: string): boolean => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Can you add some tests for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in efa9787.

Copy link
Contributor

@orinokai orinokai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome stuff, thanks @Skn0tt

@kodiakhq kodiakhq bot merged commit a8bb0e3 into main May 22, 2023
@kodiakhq kodiakhq bot deleted the guard-split-api-routes-by-next-version branch May 22, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants