Skip to content

Error caused by undefined request. #2403

@strongpauly

Description

@strongpauly

Describe the bug

  • Node.js version: v22.3.0
  • OS & version: Debian 12

Actual behavior

Relates to #2390

Error in logs:

TypeError: Cannot read properties of undefined (reading 'emit')
  File "/usr/src/app/node_modules/got/dist/source/core/index.js", line 331, col 35, in ClientRequest.?
    this._request.emit('upload-complete');
  File "/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js", line 50, col 55
    return manager.with(context, () => target.apply(this, args));
  File "node:internal/async_local_storage/async_hooks", line 91, col 14, in AsyncLocalStorage.run
  File "/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js", line 33, col 40, in SentryContextManager.with
    return this._asyncLocalStorage.run(context, cb, ...args);
  File "/usr/src/app/node_modules/@sentry/node/node_modules/@sentry/opentelemetry/build/cjs/index.js", line 1415, col 24, in SentryContextManager.with
    return super.with(ctx2, fn, thisArg, ...args);
  File "/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js", line 50, col 32, in ClientRequest.contextWrapper
    return manager.with(context, () => target.apply(this, args));
  File "node:events", line 632, col 28, in Object.onceWrapper
  File "node:events", line 530, col 35, in ClientRequest.emit
  File "/usr/src/app/node_modules/got-scraping/dist/index.js", line 667, col 14, in request.emit
    return emit(event, ...args);
  File "node:_http_outgoing", line 1081, col 10, in onFinish

Expected behavior

No error to occur

Code to reproduce

Not easily reproducible.

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions