Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request. #1179

Closed
danielmoraes opened this issue Aug 2, 2023 · 4 comments

Comments

@danielmoraes
Copy link

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2023.7.1

What version of Remix are you using?

1.19.1

Steps to Reproduce

  • Upgrade Hydrogen
    • @shopify/hydrogen from 2023.4.6 to 2023.7.1
  • Upgrade Remix
    • @remix-run/css-bundle from 1.17.1 to 1.19.1
    • @remix-run/dev from 1.17.1 to 1.19.1
    • @remix-run/react from 1.17.1 to 1.19.1
  • Upgrade Remix Oxygen
    • @shopify/remix-oxygen from 1.1.1 to 1.1.2

Expected Behavior

The shopify/oxygenctl-action@v4 action succeeds.

Actual Behavior

The shopify/oxygenctl-action@v4 action fails at the "Uploading deployment..." step with:

InvalidScriptError: retrying will not succeed. The following error must be actioned:
Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.

image
@duncan-fairley
Copy link
Contributor

This is happening for us currently across multiple Hydrogen storefronts after updating to 2023.7.x

@duncan-fairley
Copy link
Contributor

Interestingly I'm also seeing this on a PR from a separate project where the only change was moving from Yarn to NPM on 2023.4.6

@danielmoraes
Copy link
Author

danielmoraes commented Aug 4, 2023

After investigating further, I identified that Sentry is causing the deployment to fail. Upgrading Sentry to the latest version doesn't resolve the problem.

More specifically, here's the line (in entry.server.tsx) that breaks the deployment:

Sentry.init({ dsn, tracesSampleRate: 1 })

@blittle
Copy link
Contributor

blittle commented Jun 21, 2024

This is a limitation with Oxygen/Cloudflare where async operations need to be done within the lifecycle of a request. Make sure you use dependencies that support worker environments.

@blittle blittle closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants