Closed ancheetah closed 1 month ago
Hi, can you verify how often other plugins are called with sls? I fear this is up to sls and nothing we can control.
Hi @lforst, with the first method, according to the logs the esbuild is run only once before the sentry plugin. It is when the sentry plugin starts that it repeatedly uploads. Here is a sample of logs that keep repeating (some info redacted). Happy to share more with you privately.
> Found 10 files
> Analyzing 10 sources
> Adding source map references
> Bundled 6 files for upload
> Bundle ID: 12345
> Uploaded files to Sentry
> Found 12 files
> File upload complete (processing pending on server)
> Organization: my-org
> Project: my-project
> Release: 12345
> Dist: None
> Upload type: artifact bundle
Nothing sticks out to me as what may cause this. Would you mind providing a reproduction example so we can investigate further? Thanks!
@lforst here is a reproduction with a Github action that you can use to test
This rang a bell and I dug out this issue: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/245
It seems like sls
is repeatedly calling esbuild. Unfortunately, from the plugin's perspective, there is nothing (reasonable) we can do to prevent the plugin being invoked multiple times. You can potentially narrow down the upload scope of the plugin with sourcemaps.assets
.
As an alternative, you can also use Sentry CLI to upload sourcemaps which you can invoke once for all of your bundles: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/
Thanks for tracking that down. I think using the Sentry CLI after building and packaging will be a good workaround. However, the sentry-esbuild plugin is still needed to inject the debug IDs at the time of packaging with sls
since it is those packaged files that will get deployed. Could you add an option to the sentry-esbuild plugin that injects the debug IDs but skips uploads?
You should not need the esbuild plugin when you use sentry-cli - see https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/#3-inject-debug-ids-into-artifacts for how to inject the debug IDs directly in this scenario! Let us know if that does not work for you.
This works for us. Thanks @mydea!
Environment
"@sentry/aws-serverless": "^8.26.0" "@sentry/esbuild-plugin": "^2.22.2" "serverless": "^3.26.0" "serverless-esbuild": "^1.52.1"
Description
Sourcemaps should be uploaded for aws lambda functions when packaging (
sls package
). I've tried two different configurations:serverless.yml
esbuild.plugin.js
serverless.yml
esbuild.config.js