Deployment failed! Got error: Your Worker exceeded the size limit of 1 MiB

Why do I get this "Worker" error when deploying my Pages project, even though my entire build output is 428 KiB (20 KiB larger than the Remix template I started with)?
[ERROR] Deployment failed!

Failed to publish your Function. Got error: Your Worker exceeded the size limit of 1 MiB. Refer to
the Workers documentation
(https://developers.cloudflare.com/workers/observability/errors/#errors-on-worker-upload) for more
details.
[ERROR] Deployment failed!

Failed to publish your Function. Got error: Your Worker exceeded the size limit of 1 MiB. Refer to
the Workers documentation
(https://developers.cloudflare.com/workers/observability/errors/#errors-on-worker-upload) for more
details.
3 Replies
Magnum🅱
Magnum🅱OP4mo ago
How do I even begin to troubleshoot this? I'm assuming the worker is not just my build directory, so how can I tell what it's size actually is? And why is deploying to a pages project referring me to the Worker documentation?
hfcRed
hfcRed4mo ago
Because page functions get deployed to a worker Im not sure how this works with frameworks, but I would assume that anything that runs on the server is packed into the worker You could run a local build to see the output and double check, there should be a server folder or similar in the output directory
zsmooth
zsmooth4mo ago
npm run build will tell you exactly how big your worker is

Did you find this page helpful?