Skip to content

fix: check for Middleware manifest & chain #1435

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 4 commits into from
Jun 29, 2022
Merged

fix: check for Middleware manifest & chain #1435

merged 4 commits into from
Jun 29, 2022

Conversation

sarahetter
Copy link

Summary

Adds a check for sortedMiddleware to fix error here: https://app.bugsnag.com/netlify/netlify-build/errors/62bc82c51f3d1700080caab6?event_id=62bc82c50095183a54e70000&i=sk&m=nw

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 Jun 29, 2022
@sarahetter sarahetter requested a review from a team June 29, 2022 19:59
@netlify
Copy link

netlify bot commented Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/62bcb7410b666d0009d62ecd
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/62bcb741fb81ed0008bead8d
😎 Deploy Preview https://deploy-preview-1435--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.

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

netlify bot commented Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/62bcb7419e1ba10009bfe881
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/62bcb741fb81ed0008bead92
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-rsc-demo/deploys/62bcb7410b666d0009d62ed2
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/62bcb741186a440009d17e23
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/62bcb741fb81ed0008bead97
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/62bcb74126218900090da00a
😎 Deploy Preview https://deploy-preview-1435--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 Jun 29, 2022

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

Name Link
🔨 Latest commit 67d9771
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/62bcb91c993c09075963aa56
😎 Deploy Preview https://deploy-preview-1435--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.

@cypress
Copy link

cypress bot commented Jun 29, 2022



Test summary

7 0 0 0


Run details

Project netlify-plugin-nextjs-static-demo
Status Passed
Commit 138486e ℹ️
Started Jun 29, 2022 8:37 PM
Ended Jun 29, 2022 8:38 PM
Duration 01:12 💡
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Jun 29, 2022



Test summary

20 0 0 0


Run details

Project netlify-plugin-nextjs-default-demo
Status Passed
Commit 138486e ℹ️
Started Jun 29, 2022 8:37 PM
Ended Jun 29, 2022 8:38 PM
Duration 01:40 💡
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Jun 29, 2022



Test summary

2 0 0 0


Run details

Project netlify-plugin-nextjs-nx-monorepo-demo
Status Passed
Commit 138486e ℹ️
Started Jun 29, 2022 8:48 PM
Ended Jun 29, 2022 8:49 PM
Duration 01:13 💡
OS Linux Ubuntu - 20.04
Browser Chrome 103

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

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.

Left a suggestion, but otherwise good to go.

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

const middlewareManifest = await loadMiddlewareManifest(netlifyConfig)

if (!process.env.NEXT_USE_NETLIFY_EDGE && middlewareManifest.sortedMiddleware.length !== 0) {
if (!process.env.NEXT_USE_NETLIFY_EDGE && middlewareManifest?.sortedMiddleware?.length) {

Choose a reason for hiding this comment

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

[dust] Consider being explicit about the length instead of coercing to boolean.

Suggested change
if (!process.env.NEXT_USE_NETLIFY_EDGE && middlewareManifest?.sortedMiddleware?.length) {
if (!process.env.NEXT_USE_NETLIFY_EDGE && middlewareManifest?.sortedMiddleware?.length > 0) {

Copy link
Author

Choose a reason for hiding this comment

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

That won't work - if middlewareManifest does not exist, then it resolves to undefined. undefined > 0 will error.

@sarahetter sarahetter changed the title fix: Middleware chain fix: check for Middleware manifest & chain Jun 29, 2022
@kodiakhq kodiakhq bot merged commit afe65eb into main Jun 29, 2022
@kodiakhq kodiakhq bot deleted the middleware-chain branch June 29, 2022 20:50
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