sentry-javascript-bundler-plugins icon indicating copy to clipboard operation
sentry-javascript-bundler-plugins copied to clipboard

Could not determine debug ID when using stdin with esbuild

Open TheHolyWaffle opened this issue 8 months ago • 2 comments

Environment

@sentry/esbuild-plugin version 3.2.1 esbuild version 0.25.0

Related to an earlier attempt to fix this by someone: #522

Steps to Reproduce

  1. Create a build.js file with the following content:
import { sentryEsbuildPlugin } from '@sentry/esbuild-plugin';
import esbuild from 'esbuild';
import { join } from 'node:path';

const result = await esbuild.build({
        stdin: {
            contents: `export const foo = 'bar';`,
        },
        outfile: join(options.outDir, `${options.outputFile}.js`),
        bundle: true,
        platform: 'node',
        target: `node${nodeVersion}`,
        external: ['@aws-sdk/*', 'dd-trace', 'datadog-lambda-js'],
        treeShaking: true,
        sourcemap: true,
        minify: true,
        plugins: [
            sentryEsbuildPlugin({
                org: 'REDACTED',
                authToken: 'REDACTED',

                project: options.sentry?.project ||,

                release: {
                    name: options.sentry?.release,
                    dist: options.sentry?.dist,
                    setCommits: { auto: true, ignoreMissing: true },
                },
                debug: true,
            }),
        ],
    });

Expected Result

It should generate sourcemaps for the provided stdin content and upload them to Sentry. Replacing the stdin option with an entryPoints: ['path/to/file.js'], does result in sourcemaps being generated and uploaded to Sentry.

Actual Result

Logs:

No sourcemaps are uploaded

[sentry-esbuild-plugin] Debug: No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.
[sentry-esbuild-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /Users/bert.degeyter/dev/showpad-typescript/packages/cdk-nodejs-function/cdk.out/e2e-nodejs-function-bert-degeyter/esbuild-src-tests-fixtures-hello-world.ts-index/index.js
  WARN    2025-02-26 16:19:11.222587 +01:00 The --use-artifact-bundle option and the SENTRY_FORCE_ARTIFACT_BUNDLES environment variable are both deprecated, and both will be removed in the next major version.
> Found 0 files
> Adding source map references
> Nothing to upload
[sentry-esbuild-plugin] Info: Successfully uploaded source maps to Sentry

TheHolyWaffle avatar Feb 26 '25 15:02 TheHolyWaffle