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

Make @sentry/google-cloud-serverless ESM compat #11776

Closed
Tracked by #11066
AbhiPrasad opened this issue Apr 24, 2024 · 3 comments · Fixed by #12149
Closed
Tracked by #11066

Make @sentry/google-cloud-serverless ESM compat #11776

AbhiPrasad opened this issue Apr 24, 2024 · 3 comments · Fixed by #12149
Assignees

Comments

@AbhiPrasad
Copy link
Member

AbhiPrasad commented Apr 24, 2024

The serverless SDKs use require to monkeypatch GCP related libraries. This does not work with ESM (and it gets even more complicated with bundling).

Currently we only emit an CJS bundle for serverless.

@joealden
Copy link

and it gets even more complicated with bundling

@AbhiPrasad is this specifically when bundling to an ESM output, or even when bundling ESM -> CJS? I'm asking as I just tried updating my companies repo to Sentry v8, and although we are still bundling and having our GCP functions run in CJS "mode", we are unable to use the new @sentry/google-cloud-serverless library as our code is authored in ESM (I guess there might be some TS config hacks to work around this, but this isn't something we are willing to do).

I understand wanting to avoid supporting ESM imports to prevent people from thinking this works when executing via ESM - I presume that's the main problem, but just wanting to know the full picture if possible!

Also, is there an ETA (or at least a plan) for supporting ESM? Just wondering what priority this is at internally at Sentry!

@Lms24
Copy link
Member

Lms24 commented May 21, 2024

we are unable to use the new @sentry/google-cloud-serverless library as our code is authored in ESM

The code we ship in our @sentry/google-cloud-serverless package is CJS only at the moment: https://unpkg.com/browse/@sentry/google-cloud-serverless@8.2.1/package.json
(although ironically, we also ship ESM code but don't provide an entry point for it)

Is the ask here to also provide an ESM (import) entry point at the moment? I recall we had a similar issue in our AWS package. I'm gonna tag @AbhiPrasad who has more context here - can we do this now or are we still blocked on something?

@AbhiPrasad
Copy link
Member Author

can we do this now or are we still blocked on something?

We can do this, but add the caveat that performance instrumentation is only supported for CJS. I can make the change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants