question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fastify: the interface of the fastify shim seems incorrect

See original GitHub issue

The interface of the fastify shim seems incorrect.

Without the new relic shim:

const fastify_1 = require('fastify');
console.log('index 2 >', fastify_1);
console.log('index 3 >', fastify_1.fastify);

Output:

index 2 > <ref *1> [Function: fastify] {
  fastify: [Circular *1],
  default: [Circular *1]
}

index 3 > <ref *1> [Function: fastify] {
  fastify: [Circular *1],
  default: [Circular *1]
}

With the newrelic fastify shim NEW_RELIC_FEATURE_FLAG_FASTIFY_INSTRUMENTATION=1

require('newrelic');
const fastify_1 = require('fastify');
console.log('index 3 >', fastify_1);
console.log('index 4 >', fastify_1.fastify);

Output:

index 3 > [Function: wrappedFastifyModule] { __NR_instrumented: true }
index 4 > undefined

This then leads to breaking anything else that may be expecting the .fastify on the module returned from require.

package_json_and_index_js.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
meeechcommented, Sep 10, 2021

@michaelgoin thanks! yeah, i kept reloading the npm info page to see when it was published. Its installed, working ok so far. Just have the ui bug (#757), but can live with that since its just cosmetic. I appreciate the quick turnaround.

thanks 👍🏼

1reaction
meeechcommented, Sep 8, 2021

@michaelgoin For me, would be nice to have the quick fix in NR for now, so I can move forward with our instrumentation. would be prefered, since a manual workaround would be tricky. (i was able to do it just to verify the issue)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors - Fastify
¶Error Handling In Node.js. ¶Uncaught Errors. In Node.js, uncaught errors are likely to cause memory leaks, file descriptor leaks, and other major production ......
Read more >
lib/shim/webframework-shim.js - Documentation
* A helper class for wrapping web framework modules. * @param {Agent} agent; * The agent this shim will use.
Read more >
NestJS: It's making me cry : r/node - Reddit
I can't define an interface for the body of a POST controller and use ... It exposes Express/Fastify underneath if you need to...
Read more >
How to enable CORS in a Fastify application - Morioh
fastify -cors: Configures the Access-Control-Allow-Origin CORS header in ... to true to reflect the request origin, or set it to false to disable...
Read more >
Security Bulletin 12 Oct 2022
CVE Number Base Score Reference CVE‑2021‑3570 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑3570 CVE‑2021‑39139 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑39139 CVE‑2021‑32626 8.8 https://nvd.nist.gov/vuln/detail/CVE‑2021‑32626
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found