Skip to content

fix: Return MiddlewareResponse obj for rewrite #2159

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 20 commits into from
Jun 23, 2023
Merged

Conversation

taty2010
Copy link
Contributor

@taty2010 taty2010 commented Jun 12, 2023

Description

Fixes https://github.com/netlify/pod-ecosystem-frameworks/issues/510

We are now returning the MiddlewareResponse from the request.rewrite() instead of NextResponse. This will allow us to utilize the setPageProp and replaceText method.

This PR is to get the initial issue resolved, we will continue the work in another PR for the init parameter.

Documentation

Tests

This page should be rewritten with the cat ad and message with geo location

You can test this change yourself like so:

  1. TODO

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

@netlify
Copy link

netlify bot commented Jun 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/649600f99798bb0008996b0d
😎 Deploy Preview https://deploy-preview-2159--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 Jun 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/649600f73d1da600087fa067
😎 Deploy Preview https://deploy-preview-2159--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 Jun 12, 2023
@netlify
Copy link

netlify bot commented Jun 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/649600f746353c000883d102
😎 Deploy Preview https://deploy-preview-2159--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 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/649600f7314bca0008f781aa
😎 Deploy Preview https://deploy-preview-2159--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 Jun 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/649600f72c41d50008d5a795
😎 Deploy Preview https://deploy-preview-2159--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 12, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/649600f75e45c900082b517e
😎 Deploy Preview https://deploy-preview-2159--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 12, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/649600f7f5db4c0007b0b58f
😎 Deploy Preview https://deploy-preview-2159--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 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/649600f72e13570008ab4efc
😎 Deploy Preview https://deploy-preview-2159--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 12, 2023

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

Name Link
🔨 Latest commit f1c210d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/649600f70b4d38000883878e
😎 Deploy Preview https://deploy-preview-2159--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.

@taty2010 taty2010 marked this pull request as ready for review June 16, 2023 19:00
@taty2010 taty2010 requested a review from a team as a code owner June 16, 2023 19:00
@taty2010
Copy link
Contributor Author

All the tests should be passing on this, there might have been an update recently with the app-dir tests. Will have to review once I'm back.

@@ -2,7 +2,7 @@
import spawn from 'cross-spawn'
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'fs'
import { writeFile } from 'fs-extra'
import { fetch as undiciFetch } from 'undici'
import { fetch as undiciFetch } from 'next/dist/compiled/undici'

Choose a reason for hiding this comment

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

I guess we never figured out why the undici dep was no longer included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It happened here c295bc2
it got removed from package-lock but it looks like it was not set as a dep in the package.json.

Choose a reason for hiding this comment

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

Once we move to Node.js 18, fetch is native, so this import won't be required.

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
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.

Looks great! :shipit:

@kodiakhq kodiakhq bot merged commit 0eda10b into main Jun 23, 2023
@kodiakhq kodiakhq bot deleted the tn-advMiddlewareRewrite branch June 23, 2023 21:46
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