Worker Deploys are Corrupted

18:02:39.394 Asset upload failed. Retrying... 18:02:39.394 APIError: A request to the Cloudflare API (/accounts/491ffb4e2aaea21bc19c73ec334e27c1/workers/assets/upload?base64=true) failed. --- Just started happening now when trying to deploy a preview build. What's interesting is that it then uploaded anyway, causing a corrupted build: 18:02:35.352 ✨ Read 1394 files from the assets directory /opt/buildhome/repo/.open-next/assets 18:02:37.029 πŸŒ€ Starting asset upload... 18:02:39.056 πŸŒ€ Found 3 new or modified static assets to upload. Proceeding with upload... 18:02:39.056 + /BUILD_ID 18:02:39.057 + /_next/static/bbHV35lxdDEEBhCISrqu6/_buildManifest.js 18:02:39.057 + /sw.js 18:02:39.394 Asset upload failed. Retrying... 18:02:39.394 APIError: A request to the Cloudflare API (/accounts/491ffb4e2aaea21bc19c73ec334e27c1/workers/assets/upload?base64=true) failed. 18:02:40.202 Uploaded 1 of 3 assets 18:02:40.460 Uploaded 2 of 3 assets 18:02:41.534 Uploaded 3 of 3 assets 18:02:41.534 ✨ Success! Uploaded 3 files (1268 already uploaded) (2.48 sec) 18:02:41.534
36 Replies
texan
texanβ€’4d ago
Hello! I see a connection drop from the client (wrangler). It looks like it was then re-uploaded. What's broken with your preview? Or did you see just an error and think maybe we didn't recover?
snipeship
snipeshipOPβ€’4d ago
just an "Internal Server Error" also, can't find anything in logs Any ideas? Is it isolated to preview deployments? Noticed an update that makes the "branch preview" more accurate, might be something that was introduced with this?
texan
texanβ€’4d ago
Are you able to share your preview url? If your worker is being invoked, then it's a problem with your user code. You can also check the observability tab in the UI to see if there's anything interesting there.
texan
texanβ€’4d ago
Can definitely confirm, this is a user exception, not in Cloudflare space
snipeship
snipeshipOPβ€’4d ago
Very strange - no workers/infra-related changes; compiling & running works fine, just not within the worker
texan
texanβ€’4d ago
I recommend adding some console logs, try/catches, , and logging πŸ™‚
snipeship
snipeshipOPβ€’4d ago
Even running the workers preview works fine (locally)... I am pretty confident that it is related to cf workers
texan
texanβ€’4d ago
You would receive a well formed error (https://developers.cloudflare.com/workers/observability/errors/) if it were from workers control plane. Have you added a try/catch to try to debug yet?
Cloudflare Docs
Errors and exceptions
Review Workers errors and exceptions.
snipeship
snipeshipOPβ€’4d ago
The opennext app already has an ErrorBoundary There is no other try-catch that can be ran - this is 100% a corrupted build I guess I'll just wait it out lol (even fully static pages are throwing the internal server error) I believe it might be related to this^ Maybe the "already uploaded"/cached files are incorrect? Do you know if it's possible to view logs of a preview deployment? Nothing shows up for the preview deployment in the observability tabs - not even requests, etc.
texan
texanβ€’4d ago
Yeah you'd have to do a gradual rollout of 0% with this new version, then you can use a version override header to invoke Checking for what I can see on our end! Which worker name is this? I see 3 modified today
snipeship
snipeshipOPβ€’4d ago
linkme-stg Will have a look
texan
texanβ€’4d ago
texan
texanβ€’4d ago
Well I'll be darned, may be an error in our assets flow. Checking..
snipeship
snipeshipOPβ€’4d ago
Hope it is(n't) (about to start losing my mind)
texan
texanβ€’4d ago
Ah yeah, so definitively-- it doesn't look like there are any matching assets on this path, we're falling back to invoking your user worker. The user worker (your worker) is returning a 500 Definitely recommend gradual rollouts (busted version at 0%) and then using the override header to force invocation of that worker DEF a pain point of not having logs for previews... sorry about that. alternatively if it's a staging worker, just fully deploy and you can roll back later πŸ™‚
snipeship
snipeshipOPβ€’4d ago
Thanks for your time! Thank you
texan
texanβ€’4d ago
Yeah totally! Happy to help with gradual rollouts if you get snagged there!
snipeship
snipeshipOPβ€’2d ago
Hey - sorry to ping you, but preview deployments are still f-ed Deploying works fine, though Same issue as https://discord.com/channels/595317990191398933/1440723603632033924/1440731013562106036
Walshy
Walshyβ€’2d ago
So from Will's looking, this was coming from your user worker Have you looked at workers logs to see what the error is?
snipeship
snipeshipOPβ€’2d ago
No, it isn’t 100% sure it’s an error on the preview deployments assets flow^ Assets are missing on preview deployments
Walshy
Walshyβ€’2d ago
https://discord.com/channels/595317990191398933/1440092870144168186/1440110929122693180 He said after checking it invoked your user Worker which is returning the 500
snipeship
snipeshipOPβ€’2d ago
well ofc the worker will return a 500 error if it has no assets the worker is an opennext web app (it expects the assets to be in place, and 0 assets are successfully uploading) it only happens in preview deployments (when running wrangler upload) the title is slightly misleading - probably something more accurate would be "Worker Preview Deploys are Corrupted"
Walshy
Walshyβ€’2d ago
Define corrupted, I can't easily see assets but OpenNext is usually SSR'd - are you SSRing or using SSG?
snipeship
snipeshipOPβ€’2d ago
corrupted meaning - it is missing a lot of JS that should be there both, and both are f-ed just an "Internal Server Error" & you can't even see any logs because preview deployments don't have any logs, and when deploying to the staging worker it works just fine
Walshy
Walshyβ€’2d ago
Ok that's not super helpful haha d5bcc37c-linkme-stg.tech-491.workers.dev - it isn't finding a index.html (expected if SSRing) so invokes the user worker and 500s ah yes.. previews not having logs is something i forgot :/
snipeship
snipeshipOPβ€’2d ago
exactly... assets are not uploading only for previews btw it used to work fine, and since ~yesterday they seem to be completely broken (no changes at all to the config, pretty confident it's an error on the CF side)
Walshy
Walshyβ€’2d ago
Looking at the prod one which will 200 This is also invoking the user worker So both preview and prod invoke the user worker - meaning, there is no index.html asset and that is expected
snipeship
snipeshipOPβ€’2d ago
yeah but prod has all the assets uploaded
Walshy
Walshyβ€’2d ago
So, yes, the issue is somewhere in the user Worker, I can't say why because well, there are no logs for either of us to see sadly We aren't hitting assets though I'm not sure where the feeling assets being missed is but we aren't hitting an asset in either one
snipeship
snipeshipOPβ€’2d ago
basically, what I think is happening - the compiled server is looking for chunked JS assets, and they are not present yes the compiled next server has a dist folder with the minified JS which it then imports dynamically those are assets I really don't think it is, as it works when you don't wrangler upload and instead you do wrangler deploy
Walshy
Walshyβ€’2d ago
Ok, we're using different meanings of assets. I can't see if the code is trying to import a module that doesn't exist and since we both can't see logs, hard to tell too sadly
snipeship
snipeshipOPβ€’2d ago
I can see that the uploaded build is missing the chunked JS from the dist
Walshy
Walshyβ€’2d ago
Is there an issue importing a module? very possible, not visibility i have but would at least still happen in the user worker where are you looking to see?
snipeship
snipeshipOPβ€’2d ago
going to send a SC
Walshy
Walshyβ€’2d ago
cc: @Dario on wrangler behaviour + opennext behaviour here version upload/deploy use the same build path so should result in the same thing but also not sure if OpenNext is doing something special that's being missed

Did you find this page helpful?