Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpApmClient is not a constructor #3609

Open
piyusharora1989 opened this issue Sep 5, 2023 · 1 comment
Open

HttpApmClient is not a constructor #3609

piyusharora1989 opened this issue Sep 5, 2023 · 1 comment
Assignees
Labels
agent-nodejs Make available for APM Agents project planning. awaiting reply community

Comments

@piyusharora1989
Copy link

Node server going down with error:
TypeError: HttpApmClient is not a constructor
0|consults-service.bundle | at createApmClient (/u01/apollo-ms/apollo-hospitals/packages/api/node_modules/elastic-apm-node/lib/apm-client/apm-client.js:40:18)
0|consults-service.bundle | at Agent.start (/u01/apollo-ms/apollo-hospitals/packages/api/node_modules/elastic-apm-node/lib/agent.js:351:21)
0|consults-service.bundle | at Module../src/consults-service/consults-service.ts (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:3522:57)
0|consults-service.bundle | at webpack_require (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:20:30)
0|consults-service.bundle | at /u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:84:18
0|consults-service.bundle | at Object. (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:87:10)
0|consults-service.bundle | at Module._compile (internal/modules/cjs/loader.js:999:30)
0|consults-service.bundle | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
0|consults-service.bundle | at Module.load (internal/modules/cjs/loader.js:863:32)
0|consults-service.bundle | at Function.Module._load (internal/modules/cjs/loader.js:708:14)
0|consults-service.bundle | at /usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/lib/ProcessContainer.js:304:25
0|consults-service.bundle | at wrapper (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
0|consults-service.bundle | at next (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
0|consults-service.bundle | at /usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
0|consults-service.bundle | at WriteStream. (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/lib/Utility.js:186:13)
0|consults-service.bundle | at WriteStream.emit (events.js:314:20)
^[[1;2B^[[1;2B0|consults-service.bundle | TypeError: HttpApmClient is not a constructor
0|consults-service.bundle | at createApmClient (/u01/apollo-ms/apollo-hospitals/packages/api/node_modules/elastic-apm-node/lib/apm-client/apm-client.js:40:18)
0|consults-service.bundle | at Agent.start (/u01/apollo-ms/apollo-hospitals/packages/api/node_modules/elastic-apm-node/lib/agent.js:351:21)
0|consults-service.bundle | at Module../src/consults-service/consults-service.ts (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:3522:57)
0|consults-service.bundle | at webpack_require (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:20:30)
0|consults-service.bundle | at /u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:84:18
0|consults-service.bundle | at Object. (/u01/apollo-ms/apollo-hospitals/packages/api/consults-service.bundle.js:87:10)
0|consults-service.bundle | at Module._compile (internal/modules/cjs/loader.js:999:30)
0|consults-service.bundle | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
0|consults-service.bundle | at Module.load (internal/modules/cjs/loader.js:863:32)
0|consults-service.bundle | at Function.Module._load (internal/modules/cjs/loader.js:708:14)
0|consults-service.bundle | at /usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/lib/ProcessContainer.js:304:25
0|consults-service.bundle | at wrapper (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
0|consults-service.bundle | at next (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
0|consults-service.bundle | at /usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
0|consults-service.bundle | at WriteStream. (/usr/local/nvm/versions/node/v12.22.12/lib/node_modules/pm2/lib/Utility.js:186:13)
0|consults-service.bundle | at WriteStream.emit (events.js:314:20)

node version 14.19.1

npm 6.14.16
elastic-apm-node version : 3.49.1

I have checked the code of apm-client but I don't see any issue there. Not sure what is impacting

@github-actions github-actions bot added agent-nodejs Make available for APM Agents project planning. community triage labels Sep 5, 2023
@david-luna
Copy link
Member

Hi @piyusharora1989

looking at the logs I see you're using webpack to bundle your app. Is that right?

If so you may be facing the issues mentioned in here
https://www.elastic.co/guide/en/apm/agent/nodejs/current/starting-the-agent.html#start-bundlers

Please check it out and if you think it does not apply to your app add a new comment with this info

Environment (please complete the following information)

  • OS: [e.g. Linux]
  • Node.js version:
  • APM Server version:
  • Agent version:

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

Agent config options:

Click to expand
replace this line with your agent config options

package.json dependencies:

Click to expand
replace this line with your dependencies section from package.json

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. awaiting reply community
Projects
None yet
Development

No branches or pull requests

2 participants