So this is somehow similar to the next topic in GH’s discussion. Although there is some difference.
Here are some highlevel details
- I have some svg icons in my website
- svg icons are bundled into 3 svg sprites (thanks to
svg-sprite
tool) - sprites are included into the page with help of
FS.readFileSync()
This morning everything was working. This evening this approach stopped to work. No change were done one my side (this project is my side gig; during the day I do full time job). Now when user opens a site he sees a 500th error. In the logs I see the next
⨯ Error: ENOENT: no such file or directory, open '/var/task/src/svg/sprites/briefs-icons-sprite.svg'
at a (/var/task/.next/server/app/[locale]/page.js:1:556457)
at e8 (/var/task/.next/server/app/[locale]/page.js:1:549697)
at ek (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:13409)
at e (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:17307)
at eO (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:17769)
at Array.toJSON (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:14915)
at stringify (<anonymous>)
at eU (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:26272)
at eB (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:84:26502) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/var/task/src/svg/sprites/briefs-icons-sprite.svg',
digest: '531188070'
}
Locally (build + start) everything still works. When I open “source” tab of any deployment in vercel’s control panel folder “sprites” is absent there.
In the manual there is next phrase
During next build
, Next.js will use @vercel/nft
to statically analyze import
, require
, and fs
usage to determine all files that a page might load.
Well seems this is not longer the case. Even if I try to redeploy old build which also 100% used to work – now they are not working as well.
I feel like Vercel did some update of their infra today (I saw some new posts in theirs blog) and I got a bad luck.
Would be grateful on any advice
- any temporary solution how to overcome this;
- a better way how to inject sprite into the page.