Skip to content

Conversation

trentm
Copy link
Member

@trentm trentm commented Jul 6, 2023

All the hard work was done in import-in-the-middle#28.

Refs: #3445

All the hard work was done in import-in-the-middle#28.

Refs: #3445
@trentm trentm self-assigned this Jul 6, 2023
@trentm trentm mentioned this pull request Jul 6, 2023
40 tasks
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jul 6, 2023
Also had to uninstall/reinstall some dev deps because `npm` was unable
to resolve where to correctly place 'acorn' (which has usage of @8 and
@7 by various other deps) and 'acorn-import-assertions' (which has a
peerDep on acorn@8). This unforunately resulted in updating some
transitive deps, so it muddies the package-lock change somewhat.
@trentm
Copy link
Member Author

trentm commented Jul 6, 2023

That fails the ESM test attempting to use @aws-sdk/client-s3. For example:

% ELASTIC_APM_CAPTURE_EXCEPTIONS=false node --experimental-loader=./loader.mjs --require=./start.js test/instrumentation/modules/@aws-sdk/fixtures/use-client-s3.mjs
{"log.level":"info","@timestamp":"2023-07-06T16:44:02.196Z","log":{"logger":"elastic-apm-node"},"agentVersion":"3.47.0","env":{"pid":7511,"proctitle":"node","os":"darwin 22.5.0","arch":"x64","host":"pink.local","timezone":"UTC-0700","runtime":"Node.js v20.2.0"},"config":{"serviceName":{"source":"default","value":"elastic-apm-node","commonName":"service_name"},"serviceVersion":{"source":"default","value":"3.47.0","commonName":"service_version"},"serverUrl":{"source":"default","value":"http://127.0.0.1:8200/","commonName":"server_url"},"logLevel":{"source":"default","value":"info","commonName":"log_level"},"captureExceptions":{"source":"environment","value":false,"sourceValue":"false"}},"activationMethod":"preload","ecs":{"version":"1.6.0"},"message":"Elastic APM Node.js Agent v3.47.0"}
(node:7511) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
file:///Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/@aws-sdk/fixtures/use-client-s3.mjs:19
  ListBucketsCommand
  ^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module '@aws-sdk/client-s3' does not provide an export named 'ListBucketsCommand'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)

Node.js v20.2.0

This is an import-in-the-middle issue, though I'm not exactly sure how tractable this will be in general. I've opened nodejs/import-in-the-middle#29

@trentm trentm marked this pull request as draft July 6, 2023 16:45
@trentm
Copy link
Member Author

trentm commented Aug 9, 2023

Note that we'll be updating to [email protected] in #3569 so this PR will need to be adjusted when we want to enable using node v20 and ESM.

@sibelius
Copy link
Contributor

what is missing here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants