-
Notifications
You must be signed in to change notification settings - Fork 91
fix: support skipProxyUrlNormalize #3190
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
Conversation
ae9bc22
to
549cfd0
Compare
|
||
const responseData = await invokeEdgeFunction(ctx, { | ||
functions: [edgeFunctionNameRoot], | ||
origin, | ||
url: `/_next/data/build_id/en/dynamic/test.json?slug=test`, | ||
}) | ||
|
||
expect( | ||
responseData.headers.get('x-next-url-pathname'), | ||
'nextUrl.pathname should not be normalized due to skipMiddlewareUrlNormalize', | ||
).toEqual('/_next/data/build_id/en/dynamic/test.json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uff, we actually didn't have any assertion that skipMiddlewareUrlNormalize
was supported - so this adds assertion for now deprecated config option mainly for older Next.js versions
📊 Package size report 0%↑
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
export const config = { | ||
runtime: 'nodejs', | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like Proxy will be Node.js only (tho it's not as of now), so I do add this explicitly here in hope the test setup won't break when Next.js ships the change to make Proxy Node.js only. If that change end up not shipping, I'll adjust the setup to run in both Edge and Node.js runtimes as we do for most of our middleware fixtures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For posterity, the breaking change was reverted before v16 stable was released: vercel/next.js#85183. We'll still need this change eventually though, so might as well ship it.
At least we will get some more test coverage for right now 😅 |
Description
skipMiddlewareUrlNormalize
next.config option is being deprecated (as part of overallmiddleware
->proxy
rename) and is being replaced byskipProxyUrlNormalize
:This adds support for the renamed config option as we need specific handling for it in our middleware/proxy handling.
Added integration tests asserting that
nextUrl
in middleware/proxy is not normalized whenskipMiddlewareUrlNormalize
/skipProxyUrlNormalize
is used. Note that while we supportedskipMiddlewareUrlNormalize
for long time, we didn't actually have test for it 😱 , so test is added for both now deprecated and new config option