-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Favicon not found with file-based metadata in standalone build #48962
Comments
same issue |
As of Next.js 13.3.4, the standalone output doesn't properly copy the favicon, and instead expects it to be present at the same path as during the build phase. A quick workaround is to add a COPY to your runner phase, mimicking the same path as provided in the error.
Brief discussion: #41745 (comment) |
My working Dockerfile 🐳:
|
Fixes #48962 Fixes #49009 Fixes #49107 ### Why For standalone mode the `fs.readFile` is executed for `route.js` when the module is loaded, then the fs operation aginst the wrong file path will break the proper module loading, then it fallbacks to `/_error` module. ### What We move the fs read operation to the first get then cache the buffer in the module level variable, so that `fs.readFile` won't be executed. As we already have prerender cache, the meta/body fs cache will be HIT and served
We got a fix out in 13.4, upgrade it to check it out if resolves the issue 🙏 |
I updated and it's now working perfectly on my setup, thank you! |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #67-Ubuntu SMP Mon Mar 13 14:22:10 UTC 2023 Binaries: Node: 16.19.0 npm: 8.19.3 Yarn: 1.22.19 pnpm: 7.21.0 Relevant packages: next: 13.3.1-canary.18 eslint-config-next: 13.3.1 react: 18.2.0 react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Metadata (metadata, generateMetadata, next/head, head.js), Standalone mode (output: "standalone")
Link to the code that reproduces this issue
https://github.com/BigOoga/standalone-metadata-bug
To Reproduce
Run
docker-compose up --build
to build the image and run the containerDescribe the Bug
Going by the error
Error: ENOENT: no such file or directory, open '/app/src/app/favicon.ico'
The server tries to open the image path as if running the server with
next start
.Expected Behavior
I'd expect the standalone build to correctly bundle the favicon and correctly path to it.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
dockerized standalone build
The text was updated successfully, but these errors were encountered: