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

open-next errors out on some favicon formats. #390

Closed
bebbi opened this issue Mar 21, 2024 · 5 comments
Closed

open-next errors out on some favicon formats. #390

bebbi opened this issue Mar 21, 2024 · 5 comments

Comments

@bebbi
Copy link

bebbi commented Mar 21, 2024

npx --yes [email protected] build fails in my next project because I used a

icon.tsx as favicon per the documentation
Removing icon.tsx and adding icon.png worked around the issue.
(As a note, icon.tsx worked in dev mode and showed a favicon as expected.

Error:

Bundling middleware function...
Bundling static assets...
Bundling cache assets...
node:fs:456
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/Users/bebbi/code/landing/.next/standalone/.next/server/app/icon/route.js.nft.json'
    at readFileSync (node:fs:456:20)
    at computeCopyFilesForPage (file:///Users/bebbi/.npm/_npx/243dd04f789c84f7/node_modules/open-next/dist/build/copyTracedFiles.js:39:42)

Possibly some relation to sst/ion#335
This came from this sst v3 issue

@conico974
Copy link
Contributor

The issue here is likely that you use export const runtime = "edge".
In V3 edge runtime needs to be in their own separate function and cannot be bundled inside of the default server or any node server function. (To be fair, there is only downsides in bundling a fake edge runtime into the default server)
We need to add a specific error here.
Could you try without this line ?

@bebbi
Copy link
Author

bebbi commented Mar 21, 2024

I've deployed it using only a call to

    const site = new sst.aws.Nextjs('Web', { domain: myDomain })  // sst ion 0.0.131

without any options in an sst.config.ts for the ion next config so I'm not sure how to act on this.

@conico974
Copy link
Contributor

conico974 commented Mar 21, 2024

I'm not talking about the ion next config, i'm talking about the icon.tsx file.
If you have this line export const runtime = "edge" inside this file, you need to remove it.
The edge runtime is useless outside of vercel or without some advanced config in open-next.config.ts

If you want more info about the open next config file you can take a look here.
Just so you know, not every feature of open-next is supported in ion. (At the moment only lambda & lambda@edge are supported)

@bebbi
Copy link
Author

bebbi commented Mar 21, 2024

Oh sorry, I didn't realize I'd copied this from the doc example.
Without the line, and with an icon.tsx, everything works 👍, thanks!
Probably a specific error would help, so I'm letting the closing up to you in case you wanted this issue to track that.

@conico974
Copy link
Contributor

The specific error has been added in [email protected].
At the moment we're on 3.0.0-rc.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants