failed deployment with no details

Recently my deployments keep failing with no logs or information. I am building my react app with vite in GitHub actions and using the wrangler action to deploy. The action reports success but on the dashboard it says failed. Here’s one of the deployment IDs: b28e7166-295c-492b-af25-f97a22ec546f It seems like it started after I added the react email package, but I’m not sure. It works fine locally so I don’t know why it wouldn’t work when deployed. Any thoughts?
11 Replies
cf-scott
cf-scott7mo ago
Hey there! Sorry about the lack of messaging on this one. It's hitting Script startup exceeded CPU time limit. If you have any other questions, please do let us know.
IEatBeans
IEatBeansOP7mo ago
I am parsing some json from a confit file that is bundled in. It’s a const that I just declared and initialized at the top of the pages file (outside of a request handled). Would this do it? I will try moving it into the handler and see if it fixes the issue
Walshy
Walshy7mo ago
yeah you're doing too much in the global scope, do that in your handler and you should be good
IEatBeans
IEatBeansOP7mo ago
Checking back and it looks like they started failing before I added that json stuff in the global scope. Here is the first deployment that it started having issues. Do you mind checking if it’s the same error? 1af16fe4-bdab-46e2-afe1-40fffb3026af And here is the render method I’m using. In a little concerned that maybe since it’s trying to SSR it could be causing different issues? https://react.email/docs/utilities/render
React Email
Render - React Email
Transform React components into HTML email templates.
Walshy
Walshy7mo ago
Error: Script startup exceeded CPU time limit.
SSR itself is fine, I do it in a bunch of sites without issue This failure is just having too much in the global scope that it's taking too long for the script to even start up
IEatBeans
IEatBeansOP7mo ago
I am home now and tested. It deploys fine if I change the <Text>This is a test email</Text> to <>This is a test email</>. Seems like the react email components are causing the issue but im not sure why since its not in the global scope
import { render } from "@react-email/render";
import React from 'react';
import { Html, Text } from "@react-email/components";


export async function onRequestGet({ request, env, data }) {

await fetch('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: "REDACTED" }],
},
],
from: {
email: 'REDACTED'
},
subject: "Test",
content: [
{
type: 'text/html',
value: render(<Text>This is a test email</Text>),
},
],
}),
})

return new Response("Success!");
}
import { render } from "@react-email/render";
import React from 'react';
import { Html, Text } from "@react-email/components";


export async function onRequestGet({ request, env, data }) {

await fetch('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: "REDACTED" }],
},
],
from: {
email: 'REDACTED'
},
subject: "Test",
content: [
{
type: 'text/html',
value: render(<Text>This is a test email</Text>),
},
],
}),
})

return new Response("Success!");
}
IEatBeans
IEatBeansOP7mo ago
Hey @Walshy | Deploying, I have been doing some more digging and noticed that the size of the react email stuff is very large. About 4M combined. Would importing these into the worker be causing this error? I tried importing them into the request function instead like this:
const Text = (await import('@react-email/components')).Text;
const render = (await import('@react-email/render')).render;
const Text = (await import('@react-email/components')).Text;
const render = (await import('@react-email/render')).render;
But that didn't resolve it and im not sure if thats how it works anyways. Do you think I could be on the right path?
No description
IEatBeans
IEatBeansOP7mo ago
No description
staticmedia
staticmedia7mo ago
Not sure if this is helpful or not. I was using wrangler-action GHA to deploy to cloudflare and it wasn't giving any errors. So I tried connecting my git repo directly in cloudflare to deploy via cloudflare (instead of using GHA and wrangler-action). There, it told me that it couldn't deploy to cloudflare's global network because 'Your Functions script is over the 1 MiB'. Here is the full output it gave me:
09:12:59.892 ✨ Compiled Worker successfully
09:13:00.100 Found _routes.json in output directory. Uploading.
09:13:00.114 Validating asset output directory
09:13:01.179 Deploying your site to Cloudflare's global network...
09:13:05.739 Uploading... (0/90)
09:13:06.794 Uploading... (30/90)
09:13:07.019 Uploading... (60/90)
09:13:07.483 Uploading... (90/90)
09:13:07.483 ✨ Success! Uploaded 90 files (2.20 sec)
09:13:07.483
09:13:07.769 ✨ Upload complete!
09:13:10.884 Success: Assets published!
09:13:15.046 Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)
09:12:59.892 ✨ Compiled Worker successfully
09:13:00.100 Found _routes.json in output directory. Uploading.
09:13:00.114 Validating asset output directory
09:13:01.179 Deploying your site to Cloudflare's global network...
09:13:05.739 Uploading... (0/90)
09:13:06.794 Uploading... (30/90)
09:13:07.019 Uploading... (60/90)
09:13:07.483 Uploading... (90/90)
09:13:07.483 ✨ Success! Uploaded 90 files (2.20 sec)
09:13:07.483
09:13:07.769 ✨ Upload complete!
09:13:10.884 Success: Assets published!
09:13:15.046 Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)
IEatBeans
IEatBeansOP7mo ago
I have to use the GitHub action to deploy because my app has multiple instances with different configs, and the GitHub integration with cloudflare only allowed one project per repo
staticmedia
staticmedia7mo ago
Gotcha. My suggestion wasn't a permanent change but purely to get more error output. I switched back to using GitHub action afterwards It seems the wrangler GitHub action doesn't see errors beyond a certain stage of deployment. This particular error shows up at the "deploying to cloudflare global network" stage, which happens right at the end of deployment
Want results from more Discord servers?
Add your server