Skip to content

Build with lots of email template timeout easily on build (Preview server) #2402

@roderickhsiao

Description

@roderickhsiao

Describe the Bug

This is only reproduces when runnning production build or on CI.
We have around 80 templates in preview server, locally running the build works fine.

But CI (Vercel) is failing randomly

Failed to build /preview/[...slug]/page: /preview/Acceptance/Verification/complete.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/Acceptance/Verification/feedback.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/Acceptance/Verification/incomplete.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/AddHomePhotos/index.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/HostingOpportunities/index.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/Recommendations/accepted-member/index.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/Recommendations/waitlisted-member/index.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /preview/[...slug]/page: /preview/Registrations/Community/index.en (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.

and eventually failing the build.

Export encountered an error on /preview/[...slug]/page: /preview/TripRequests/Decline/swap-no-matches-notes/index.en, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null
Error: Unable to build the Next app and it exited with code: 1
    at ChildProcess.<anonymous> (file:///vercel/path0/node_modules/react-email/dist/index.js:246:11)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5)
error Command failed with exit code 1.

Our email template are not dynamiclly fetching any data, mostly just read static json and render, wondering how will the build over 60 seconds?

I suspect that it might be the https://react.email/api/check-spam check that reach ratelimit when build hit multiple at the same time?

Are we able to change the dynamic value or something? Honestly, the spam check could move to client side not nessarily need to run on build time.

Which package is affected (leave empty if unsure)

@react-email/preview

Link to the code that reproduces this issue

https://github.com/resend/react-email

To Reproduce

  1. Have a preview server with 80-100 templates
  2. Run production build
  3. WIll notice in console there are multiple timeout and retry

Expected Behavior

  1. Have a preview server with 80-100 templates
  2. Run production build
  3. Shouldn't see any timeout on build

What's your node version? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions