"fastify.use is not a function" problem

Feature(s) impacted

Run the fastify agent

Observed behavior

Since few time, when I try to run my project with the fastify agent, I have a failure during the add of the agent to the fastify instance : “fastify.use is not a function”. In debug mode, I’m observing a fail in the framework-mounter.js, in the useCallbackOnFastify function, when the fastify.use function is used.

Expected behavior

The add of the Forest Agent to my fastify instance.

Failure Logs

TypeError: fastify.use is not a function
    at Agent.useCallbackOnFastify (/Users/valerianguivarch/IdeaProjects/re-sources-app-backend-v2/node_modules/@forestadmin/agent/src/framework-mounter.ts:115:15)
    at Agent.mountOnFastify (/Users/valerianguivarch/IdeaProjects/re-sources-app-backend-v2/node_modules/@forestadmin/agent/src/framework-mounter.ts:69:10)
    at ForestAgent.mountOnFastifyAndStart (/Users/valerianguivarch/IdeaProjects/re-sources-app-backend-v2/src/main/backoffice/ForestAgent.ts:20:23)

Context

  • Project name: re-sources-v2
  • Team name: Appstud
  • Environment name: node.js
  • Agent type & version:
    @fastify/cors”: “^8.1.0”,
    @forestadmin/agent”: “^1.0.0”,
    @forestadmin/datasource-mongoose”: “^1.0.2”,
  • Recent changes made on your end if any: none, I think…

Hello @Valerian_Guivarch

Does it always crash, or is it an intermittent issue?

So that we can reproduce the issue, could you

  • Show us the code where you mount your agent on fastify
  • Tell us which fastify version you are using