node-clinic icon indicating copy to clipboard operation
node-clinic copied to clipboard

How do I use clinic.js with nuxt?

Open sjahns opened this issue 1 year ago • 8 comments

I want to use clinic js for a nuxt application but have so far been unable to get it to work. I am at a loss at what the command has to look like. From what I have seen I need to give clinic a js file to execute.

I prepare a build with npm run build and then how do I continue? The only way I got something other than an error was clinic doctor -- node .nuxt/dist/server/server.js but that gives an empty analysis. How do I tell clinic js to analyse the page that I would find under "localhost:3000/jobs" for example? I tried things like clinic doctor --on-port 'wrk http://localhost:$PORT/jobs' -- node .nuxt/dist/server/server.js' clinic doctor --autocannon [ -m GET 'http://localhost:$PORT/jobs' ] -- node .nuxt/dist/server/server.js

But again I am not even sure if that is the correct file.

Thanks.

Environment

  • Clinic.js version:v13.0.0
  • Doctor version: v11.0.0
  • nuxt version: 2.16.*
  • Node.js version: v16.20.1
  • npm version: 9.8.0

sjahns avatar Jul 13 '23 12:07 sjahns

I tried things like clinic doctor --on-port 'wrk http://localhost:$PORT/jobs' -- node .nuxt/dist/server/server.js' clinic doctor --autocannon [ -m GET 'http://localhost:$PORT/jobs' ] -- node .nuxt/dist/server/server.js

That's correct, but you need to consider this will evaluate the server.js operations in the backend. This won't give you information about scripts evaluated in the front-end side.

RafaelGSS avatar Jul 13 '23 12:07 RafaelGSS

Yes I am aware, but those commands give me empty results. Profile data collected seems to be empty, report may not be generated Also it runs so quickly that i am sure it doesn't do anything.

sjahns avatar Jul 14 '23 06:07 sjahns

Try changing it to:

$ clinic doctor --autocannon [ -d 30 -c 100 /jobs ] -- node .nuxt/dist/server/server.js

RafaelGSS avatar Jul 14 '23 12:07 RafaelGSS

Sorry for the delay, was busy the last week.

I get the same empty result with that command.

sjahns avatar Jul 24 '23 07:07 sjahns

can you create a minimal reproducible code?

RafaelGSS avatar Jul 24 '23 12:07 RafaelGSS

same issue, after ctrl+c got error

Error: process exited by signal SIGABRT
    at ChildProcess.<anonymous> (/Users/xxx/.nvm/versions/node/v18.14.0/lib/node_modules/clinic/node_modules/@clinic/doctor/index.js:139:13)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

ly95 avatar Aug 04 '23 04:08 ly95

Sorry for the delay

https://github.com/sjahns/clinic-test

I just created an empty nuxt project and tried to use clinic doctor. Same result, as in empty result.

This is Nuxt 2.17 though.

sjahns avatar Aug 16 '23 06:08 sjahns

same issue, after ctrl+c got error

Error: process exited by signal SIGABRT
    at ChildProcess.<anonymous> (/Users/xxx/.nvm/versions/node/v18.14.0/lib/node_modules/clinic/node_modules/@clinic/doctor/index.js:139:13)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

I'm having this issue by running any app with clinic doctor. tried it with NestJs and NodeJs. Even I get it while running the official sample.

sudo clinic doctor --on-port 'autocannon localhost:$PORT' -- node slow-event-loop

AminAzGol avatar Jan 13 '24 12:01 AminAzGol