Skip to content
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

Rewrites to _next/static files not working #2628

Open
pieh opened this issue Sep 27, 2024 · 0 comments
Open

Rewrites to _next/static files not working #2628

pieh opened this issue Sep 27, 2024 · 0 comments
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests

Comments

@pieh
Copy link
Contributor

pieh commented Sep 27, 2024

Asset prefix tests with fixture like this: https://github.com/vercel/next.js/blob/4837a67fb9bc7199e48cd8bd2cc42659b17dfacc/test/e2e/app-dir/asset-prefix/next.config.js

is unable to handle rewrite that would match static files (such as /custom-asset-prefix/_next/static/chunks/app/page-0c41902c3edd4280.js which should just serve /_next/static/chunks/app/page-0c41902c3edd4280.js)

This results in failure for those tests:

Some investigation notes:

It seems like next-server is building maps of various such files on server initialization ( https://github.com/vercel/next.js/blob/4837a67fb9bc7199e48cd8bd2cc42659b17dfacc/packages/next/src/server/lib/router-utils/filesystem.ts#L98-L680 ) and later used in when handling requests ( https://github.com/vercel/next.js/blob/4837a67fb9bc7199e48cd8bd2cc42659b17dfacc/packages/next/src/server/lib/router-server.ts#L417-L525 ), but we are not bundling those files into server handler and therefore it falls back to 404 case that we see.

This is possible same root issue as #2465 (?)

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: test/e2e/app-dir/asset-prefix/asset-prefix.test.ts, test/e2e/app-dir/asset-prefix-with-basepath/asset-prefix-with-basepath.test.ts
reason: Rewrites to _next/static files not working

@pieh pieh added the Next.js e2e test failure Errors identified through the Next.js repo e2e tests label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests
Projects
None yet
Development

No branches or pull requests

1 participant