Skip to content

fix: check for middleware manifest before providing to Object.keys #1559

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 2 commits into from
Aug 18, 2022

Conversation

sarahetter
Copy link

Summary

Fixes the onBuild error TypeError: Cannot convert undefined or null to object when providing a null middlewareManifest, or null middlewareManifest.functions to Object.keys. This can happen with Next 11 (no middlewareManifest), and middleware beta (no middlewareManifest.functions)

Test plan

  1. Visit the Deploy Preview (insert link to specific page) ...

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

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.

@sarahetter sarahetter self-assigned this Aug 18, 2022
@sarahetter sarahetter requested a review from a team August 18, 2022 15:57
@netlify
Copy link

netlify bot commented Aug 18, 2022

Deploy Preview for next-hp-edge-demo ready!

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/next-hp-edge-demo/deploys/62fe62bbf3a5a00009e56094
😎 Deploy Preview https://deploy-preview-1559--next-hp-edge-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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/62fe62bbb92dc60009e7d0b6
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/62fe62bbc83b350009140c64
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/62fe62bb6be5ac0008ba90df
😎 Deploy Preview https://deploy-preview-1559--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.

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

netlify bot commented Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/62fe62bb4e96e70008dd5793
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/62fe62bbf11d380009dd9464
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/62fe62bba55c220008d9da3f
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

Deploy Preview for next-plugin-rsc-demo ready!

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-rsc-demo/deploys/62fe62bb5d974100080e1e05
😎 Deploy Preview https://deploy-preview-1559--next-plugin-rsc-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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/62fe62bb2b2cd70008ec3bf1
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

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

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/62fe62bb4a78a90008f47f5a
😎 Deploy Preview https://deploy-preview-1559--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 Aug 18, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 85e65c0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/62fe62bb363c3800080de475
😎 Deploy Preview https://deploy-preview-1559--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.

@@ -85,7 +85,7 @@ const plugin: NetlifyPlugin = {

let usingEdge = false

if (Object.keys(middlewareManifest?.functions).length !== 0) {
if (middlewareManifest?.functions && Object.keys(middlewareManifest.functions).length !== 0) {
usingEdge = true
if (process.env.NEXT_DISABLE_NETLIFY_EDGE) {
failBuild(outdent`
Copy link
Contributor

Choose a reason for hiding this comment

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

There's the same for middlewareManifest?.middleware below

Copy link
Author

Choose a reason for hiding this comment

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

facepalm on it

@sarahetter sarahetter requested a review from ascorbic August 18, 2022 16:03
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Thanks!

@kodiakhq kodiakhq bot merged commit f500f51 into main Aug 18, 2022
@kodiakhq kodiakhq bot deleted the missing-manifest branch August 18, 2022 17:28
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.

2 participants