sentry-javascript-bundler-plugins: @sentry/esbuild-plugin / Version 2.2.2 / all external modules are missing

Environment

Versions @sentry/esbuild-plugin: “^2.2.2” esbuild": “^0.18.2”

Steps to Reproduce

create a bundle wit rebuild and sentry plugin:

import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import esbuild from "esbuild"
import { config } from "dotenv"
import { rm } from "fs/promises";
import { existsSync } from "fs";

config()

const outdir = "./dist-serverless"

if (existsSync('firstDirectory')) {
    await rm(outdir, { recursive: true })
}

esbuild.build({
    entryPoints: ["./server/aws_lambda_trpc.ts", "./server/aws_lambda_ssr.ts",
        "./server/aws_lambda_upload.ts", "./server/aws_lambda_cfix.ts", "./server/aws_lambda_batchjobs.ts", "./server/aws_lambda_worker.ts"],
    outdir,
    //outfile: "aws_lambda_trpc.cjs",
    format: "cjs",
    platform: "node",
    external: ["@sentry/serverless", "@aws-sdk/client-s3", "@aws-sdk/client-dynamodb", "@aws-sdk/client-sesv2", "ssh2"],
    bundle: true,
    sourcemap: true, // Source map generation must be turned on
    plugins: [
        //Put the Sentry esbuild plugin after all other plugins
        sentryEsbuildPlugin({
            debug: true,
            org: "ORG",
            project: "PROJECT",

            // Specify the directory containing build artifacts
            include: outdir,

            // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
            // and need `project:releases` and `org:read` scopes
            authToken: process.env.SENTRY_AUTH_TOKEN,

            // Optionally uncomment the line below to override automatic release name detection
            // release: process.env.RELEASE,
            release: process.env.SENTRY_RELEASE
        }),
    ],
});

Expected Result

on file per entry point with all external modules bundled

Actual Result

all imported modules and external modules are missing in the bundled file

This problem does not exist with previous version 2.2.1

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@ilijapuaca I believe that version had an issue if you emitted multiple bundles with esbuild. Each of the bundles contained the same debug ID, whereas it should be different in each output bundle. If you’re only generating one file, that version should be fine.

Hi, a release is lined up - likely gonna happen on Monday. Didn’t wanna cause bigger problems right before the weekend.

https://github.com/getsentry/publish/issues/2388

Hi again, thanks for providing reproduction - made it super easy to figure out what was wrong!

I opened a PR to fix this: https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/322