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

Using Sentry with Remix when using Architect (Lambda wrapper) #6062

Open
AbhiPrasad opened this issue Oct 27, 2022 Discussed in #6050 · 4 comments
Open

Using Sentry with Remix when using Architect (Lambda wrapper) #6062

AbhiPrasad opened this issue Oct 27, 2022 Discussed in #6050 · 4 comments

Comments

@AbhiPrasad
Copy link
Member

Discussed in #6050

Originally posted by alexmk92 October 26, 2022
We've built a new product at work which is using Remix and deployed to the edge using Architect (wrapper around CloudFormation and Lambda)

It's working great, but we're massively missing out on visibility into the app. I installed the Remix SDK today and it works great for reporting client side metrics; the server-side however receives no information due to the fact we're not using Remix's default server execution handler.

In the interim, I've pulled in the serverless SDK as well as the Remix SDK and exported the remix Lambda handler after initialising the app using the Remix SDK:

 import { createRequestHandler } from "@remix-run/architect";
import * as build from "@remix-run/dev/server-build";
import { env } from "~/utils/env";
import { AWSLambda } from "@sentry/serverless";
import * as Sentry from "@sentry/remix";

Sentry.init({
  dsn: env("SENTRY_DSN") as string,
  environment: env("NODE_ENV") as string,
  tracesSampleRate: parseInt(env("SENTRY_TRACE_SAMPLE_RATE", 1) as string),
  // ...
});

export const handler = AWSLambda.wrapHandler(
  createRequestHandler({
    build,
    mode: env("NODE_ENV", "development") as string,
  })
);

I'm now getting some metrics out of my server-side code, but its very limited in use as all routes are named as AppEnvAnyCatchAllHttpLambda. I'm guessing this is where a dedicated remix wrapper would need to be created to add additional meta information to the trace (such as the route, params etc)

image

What steps would I need to take to provision a Remix Lambda extension? I'm happy to tinker with it, I've just got no idea where to start (the existing Lambda implementation was a bit over my head 🤯)

@AbhiPrasad
Copy link
Member Author

We need to probably add a wrapper for serverless similar to what we do for express request handling.

@cole-sanderson
Copy link

Bump for the fix 🙏

@meza
Copy link

meza commented Jul 21, 2023

Another bump?

@Lms24
Copy link
Member

Lms24 commented Aug 3, 2023

This remains backlogged at the moment due to prioritization of other tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

5 participants