Skip to content

[BUG]: ERR_INVALID_RETURN_PROPERTY_VALUE error when starting up Nuxt 3 app #5720

@paambaati

Description

@paambaati

Tracer Version(s)

5.51.0, 5.50, 5.49.0

Node.js Version(s)

20.18.1

Bug Report

When starting up a Nuxt 3 app like this –

node --import dd-trace/register.js --trace-warnings .output/server/index.mjs

I get this error –

❯ node --import dd-trace/register.js --trace-warnings .output/server/index.mjs
node:internal/modules/esm/translators:129
  throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
        ^

TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string, array buffer, or typed array to be returned for the "source" from the "load" hook but got undefined.
    at assertBufferSource (node:internal/modules/esm/translators:129:9)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:164:3)
    at callTranslator (node:internal/modules/esm/loader:428:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:30) {
  code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}

Node.js v20.18.1

Curiously, when starting the app without the --import dd-trace/register.js flag, the app starts up fine without issues.

Reproduction Code

  1. Set up a Nuxt 3 app (issue reproducible with both Vite 2.x and Vite 3.x).
  2. Build it using nuxt build.
  3. Start it using node --import dd-trace/register.js .output/server/index.mjs

Error Logs

node:internal/modules/esm/translators:129
  throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
        ^

TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string, array buffer, or typed array to be returned for the "source" from the "load" hook but got undefined.
    at assertBufferSource (node:internal/modules/esm/translators:129:9)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:164:3)
    at callTranslator (node:internal/modules/esm/loader:428:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:30) {
  code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}

Node.js v20.18.1

Tracer Config

DD_APM_ENABLED: true
DD_TRACE_ENABLED: true
DD_LOGS_INJECTION: true

Operating System

Darwin Mac 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6030 arm64

Bundling

Vite

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions