-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
BugPackage: aws-serverlessIssues related to the Sentry AWS Serverless SDKIssues related to the Sentry AWS Serverless SDK
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/aws-serverless
SDK Version
8.34.0
Framework Version
NodeJS v20
Link to Sentry event
No response
Reproduction Example/SDK Setup
Import Sentry from any Sentry javascript package above 8.29.0
main.mjs
:
import * as Sentry from "@sentry/aws-serverless";
Package.json dependencies:
"@sentry/aws-serverless": "^8.34.0",
"@sentry/node": "^8.34.0",
"@sentry/profiling-node": "^8.34.0",
Run node main.mjs
, get the error:
file:///PROJECT_LOCATION/node_modules/@sentry/node/build/esm/sdk/initOtel.js:6
import { ATTR_SERVICE_NAME, SEMRESATTRS_SERVICE_NAMESPACE, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ATTR_SERVICE_NAME' not found. The requested module '@opentelemetry/semantic-conventions' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@opentelemetry/semantic-conventions';
const { ATTR_SERVICE_NAME, SEMRESATTRS_SERVICE_NAMESPACE, ATTR_SERVICE_VERSION } = pkg;
The @opentelemetry/semantic-conventions
package does not support ESModules correctly (yet) and therefore the imports must be written like the error states as global import statements, where the variables can be destructered from.
If I manually resolve the error, I get the same error within other Sentry package files, so the codebase must be scanned on multiple references.
Steps to Reproduce
- Create a main.mjs file with the import Sentry statement:
import * as Sentry from "@sentry/aws-serverless";
- Ensure that you installed the packages
- Run
node main.mjs
Expected Result
No import errors coming from any Sentry package.
Actual Result
Cannot use Sentry Javascript packages in any way in ESModules project
Metadata
Metadata
Assignees
Labels
BugPackage: aws-serverlessIssues related to the Sentry AWS Serverless SDKIssues related to the Sentry AWS Serverless SDK
Projects
Status
No status