-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: Add docs for Shopify Hydrogen #11580
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
docs/platforms/javascript/guides/remix/frameworks/hydrogen.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| title: Shopify Hydrogen Guide | ||
| description: "Learn how to use the Sentry Remix SDK to instrument your Shopify Hydrogen app." | ||
| --- | ||
|
|
||
| If you're using the Shopify Hydrogen framework, you can use the Sentry Remix SDK to add Sentry instrumentation to your app. | ||
|
|
||
| First, install the Sentry Remix SDK in your application. We recommend using the Sentry wizard to automatically install the SDK: | ||
|
|
||
| ```bash | ||
| npx @sentry/wizard@latest -i remix | ||
| ``` | ||
|
|
||
| If the setup through the wizard doesn't work for you, you can also [set up the Remix SDK manually](/platforms/javascript/guides/remix/manual-setup/). | ||
|
|
||
| After installing the Sentry Remix SDK, delete the newly generated `instrumentation.server.mjs` file and all newly generated code from `entry.server.tsx`. This instrumentation is not needed because you are going to use the Sentry Cloudflare SDK for server-side instrumentation. | ||
|
|
||
| Now you can install the Sentry Cloudflare SDK. First, install the SDK with your package manager: | ||
|
|
||
| <PlatformContent includePath="getting-started-install" /> | ||
|
|
||
| Then update your `server.ts` file to use the `wrapRequestHandler` method | ||
AbhiPrasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```ts {filename:server.ts} | ||
| import { wrapRequestHandler } from "@sentry/cloudflare"; | ||
|
|
||
| /** | ||
| * Export a fetch handler in module format. | ||
| */ | ||
| export default { | ||
| async fetch( | ||
| request: Request, | ||
| env: Env, | ||
| executionContext: ExecutionContext | ||
| ): Promise<Response> { | ||
| return wrapRequestHandler( | ||
| { | ||
| options: { | ||
| dsn: "YOUR_DSN_HERE", | ||
| tracesSampleRate: 1.0, | ||
| }, | ||
| // Need to cast to any because this is not on cloudflare | ||
| request: request as any, | ||
| context: executionContext, | ||
| }, | ||
| async () => { | ||
| // request handling logic | ||
| } | ||
| ); | ||
| }, | ||
| }; | ||
| ``` | ||
|
|
||
| To remove errors relating to `node:async_hooks` (which is included in the sdk, but not used by `wrapRequestHandler`), add a custom vite plugin to your `vite.config.ts` file that will alias it to an empty module. | ||
AbhiPrasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```ts {filename:vite.config.ts} | ||
| export function removeAsyncHooksPlugin(): Plugin { | ||
| return { | ||
| name: "remove-async-hooks", | ||
| load: (id) => { | ||
| if (id === "node:async_hooks") { | ||
| return "export default {}"; | ||
| } | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [ | ||
| removeAsyncHooksPlugin(), | ||
| // rest of your plugins | ||
| ], | ||
| }); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: Cloudflare SDK Framework Guide | ||
| description: "Learn how to set up the Remix SDK with popular Frameworks like Hydrogen." | ||
| --- | ||
|
|
||
| You can use the Sentry Remix SDK to setup Sentry with frameworks like Shopify Hydrogen. | ||
|
|
||
| <PageGrid /> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.