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

feat(remix): Add support for Hydrogen #15450

Merged
merged 9 commits into from
Feb 25, 2025
Merged

feat(remix): Add support for Hydrogen #15450

merged 9 commits into from
Feb 25, 2025

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Feb 20, 2025

This PR adds support for Shopify Hydrogen applications running on MiniOxygen runtime.

Resolves: #5610

What's updated

Issue with node:async_hooks (#5610 (comment))

  • @sentry/cloudflare has a new export path called ./request to import only the request wrapper without involving async.ts which imports node:async_hooks. That fixes the build problems on the MiniOxygen environment.

Issue with imported empty modules on MiniOxygen (Related: vitejs/vite#10612)

  • @sentry/remix has a new export path called ./cloudflare to fix empty methods in the imported modules. The problem there seemed to be the re-exports that are somehow not resolved. So with this, I also updated the file structure of Remix SDK to separate the client/server/cloudflare code with their own per-folder index files.

Issue having loader and action spans

  • This is currently not supported on cloudflare environments on the auto-instrumented flow. To support them, I re-introduced the span creation flow we were using before migration. That's a step back from feat(remix)!: Remove autoInstrumentRemix option #15074, but by default this logic is disabled. It's enabled by default when insturmentBuild is imported from @sentry/remix/cloudflare.

The root server spans are not parameterised

That's because we don't have the Remix routes information on @sentry/cloudflare's request wrapper. I have tried updating the root span's name inside @sentry/remix/cloudflare's logic and it works. But I have left it out for now, not to make this PR even more difficult to review.

Copy link

codecov bot commented Feb 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4649 1 4648 323
View the top 1 failed test(s) by shortest run time
express tracesSampler includes normalizedRequest data CJS correctly samples & passes data to tracesSampler
Stack Traces | 0.708s run time
Error: socket hang up
    at Function.Object.<anonymous>.AxiosError.from (.../lib/core/AxiosError.js:92:14)
    at RedirectableRequest.handleRequestError (.../lib/adapters/http.js:620:25)
    at RedirectableRequest.emit (node:events:517:28)
    at ClientRequest.eventHandlers.<computed> (.../node_modules/follow-redirects/index.js:49:24)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketOnEnd (node:_http_client:525:9)
    at Socket.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at Axios.request (.../lib/core/Axios.js:45:41)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.makeRequest (.../node-integration-tests/utils/runner.ts:445:78)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@onurtemizkan onurtemizkan marked this pull request as ready for review February 24, 2025 17:11
@@ -838,7 +838,7 @@ jobs:
# See: https://github.com/actions/runner/issues/2205
if: always() && needs.job_e2e_prepare.result == 'success' && needs.job_e2e_prepare.outputs.matrix != '{"include":[]}'
needs: [job_get_metadata, job_build, job_e2e_prepare]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this: cloudflare/workerd#3411

Copy link
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

const wrappedEntry = { ...build.entry, module: { ...build.entry.module } };

// Add warning?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be a permanent comment or is this left from developing?
In case it is permanent, maybe explain which warning you mean here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a leftover from development. Removed it 👍

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @onurtemizkan!

Mind opening a docs PR for this as well? We should update https://docs.sentry.io/platforms/javascript/guides/remix/frameworks/hydrogen/

@AbhiPrasad AbhiPrasad merged commit 3368a1a into develop Feb 25, 2025
149 checks passed
@AbhiPrasad AbhiPrasad deleted the onur/remix-hydrogen branch February 25, 2025 14:26
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

Successfully merging this pull request may close these issues.

RemixJS - Cloudflare Server Adapter - Sentry Wrapper
3 participants