AppD Archive

NodeJS, Express: Error: invalid json, empty body

CommunityUser
Splunk Employee
Splunk Employee

Hello, I am using the profiling tool on my app.

I use NodeJS v0.10.29 with npm v3.3.9.

I successfully installed appdynamics@4.1.4 (Run on debian 8.2)

I put the required piece of code in my app.js

require("appdynamics").profile({
    controllerHostName: 'paidxxx.saas.appdynamics.com',
    controllerPort: 80,
    accountName: 'xxx',
    accountAccessKey: 'xxx',
    applicationName: 'xxx',
    tierName: 'xxx',
    nodeName: 'process'
});

Now, for any POST JSON request I make the server fails with

Error: invalid json, empty body
  at Object.exports.error (/home/xxx/yyy/node_modules/express/node_modules/connect/lib/utils.js:62:13)
  at IncomingMessage.<anonymous> (/home/xxx/yyy/node_modules/express/node_modules/connect/lib/middleware/json.js:61:29)
  at IncomingMessage.emit (events.js:92:17)
  at _stream_readable.js:929:16
  at appd_proxy (/home/xxx/yyy/node_modules/appdynamics/lib/core/proxy.js:289:20)
  at process._tickDomainCallback (node.js:463:13)

I made some little researches, and it looks like it has something to do with `connect` that Express is using.

I can hardly change its version without breaking everything.

Is there a way to make the profiling tool work with my current project?

Thank you

0 Karma

Allan_Schiebold
Communicator

Hi.

Make sure you've successfully installed the npm package for AppDynamics. Also, the location of the "require" statement can effect functionality. 

https://docs.appdynamics.com/display/PRO41/Install+the+Node.js+Agent

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...