Skip to content

Error thrown when using @elastic/ecs-pino-format v1.4.0 #3774

@gilmoreorless

Description

@gilmoreorless

Describe the bug

Background context:

  1. PR chore(deps): bump @elastic/ecs-pino-format from 1.4.0 to 1.5.0 #3708 auto-bumped the dependency of @elastic/ecs-pino-format from 1.4.0 to 1.5.0.
  2. 1.5.0 added a new named ecsFormat export as the preferred API.
  3. chore(deps): bump @elastic/ecs-pino-format from 1.4.0 to 1.5.0 #3708 got an additional commit that used the named export instead of the old default export.
  4. This was released in elastic-apm-node v4.2.0 (but wasn't mentioned in the changelog).

The problem:

  1. Unfortunately, chore(deps): bump @elastic/ecs-pino-format from 1.4.0 to 1.5.0 #3708 only bumped package-lock.json but left package.json alone, so it still publishes a dependency on "@elastic/ecs-pino-format": "^1.4.0"
  2. Some projects can update to elastic-apm-node@4.2.0 but still use @elastic/ecs-pino-format@1.4.0, especially when package lockfiles are taken into account.
  3. Using this combination means const { ecsFormat } = require('@elastic/ecs-pino-format') returns undefined, then later throws TypeError: ecsFormat is not a function

To Reproduce

Presumably, running npm install @elastic/ecs-pino-format@1.4.0 in this repo then running the tests should show the error.
I can't tell for certain because trying to run this repo's tests on my M2 mac failed to pull some Docker images.

Expected behavior

Changing the package.json minimum dependency to ^1.5.0 should fix the error.

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Additional context

I would have quickly raised a PR for this, but I couldn't run the tests. (Also, a single-character PR isn't worth the hoops I'd have to jump through to sign the corporate CLA, unfortunately.)

Metadata

Metadata

Assignees

Labels

agent-nodejsMake available for APM Agents project planning.communityimpact:highShort-term priority; add to current release, or definitely next.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions