Vercel builds randomly cause all SSR routes to fail #11775
Labels
- P5: urgent
Fix build-breaking bugs affecting most users, should be released ASAP (priority)
pkg: vercel
Related to Vercel adapter (scope)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
On the server
Describe the Bug
We generate this apply function that ends up in the entrypoint chunk to set up the Web API globals we use:
The SSR manifest goes into its own chunk that has:
The
decodeKey
comes from a separate file and is just this:Neither the manifest chunk nor the chunk defining
decodeKey
depend on the entrypoint chunk that defines and calls thatapply
function configuring crypto.It seems there is some reliance on the ordering of some of the hashes to determine how things get generated that might run the top-level code from the manifest chunk before the top-level code for the entrypoint chunk sets the crypto global. When that happens, calling any SSR route from that build on Vercel results in a 500 status with the following error on the server logs:
My guess that this is relying on ordering defined by some hash is because repeatedly building the same code either always works or always breaks, so there doesn't seem to have some randomness. Changing the name of a file (any file) changes the content of the manifest chunk and, therefore, its hash. Testing random names to see the effect it randomly works and stops working.
What's the expected result?
Build should always result in working code
Link to Minimal Reproducible Example
Only reproducible with Vercel prod builds
Participation
The text was updated successfully, but these errors were encountered: