Make `@sentry/google-cloud-serverless` ESM compat
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.
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!
we are unable to use the new
@sentry/google-cloud-serverlesslibrary 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/[email protected]/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?
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!