Skip to content

fastify.inject timeout when @fastify/nextjs is registered #748

@joshuaavalon

Description

@joshuaavalon

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.17.0

Plugin version

9.2.0

Node.js version

v20.1.0

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

10

Description

When I run unit tests by fastify.inject, it timeout after several requests.

- event compiled client and server successfully in 639 ms (151 modules)
      1) should create user with admin role
- event compiled client and server successfully in 311 ms (151 modules)
      ✔ should create normal user (1291ms)
    login
      2) should login admin user
      3) should login normal user
    me
      4) should return admin user
      5) should return normal user


  1 passing (11s)
  5 failing

  1) User
       createUser
         should create user with admin role:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\Users\user\project\git\api2\dist\__tests__\index.js)
      at listOnTimeout (node:internal/timers:573:17)
      at process.processTimers (node:internal/timers:514:7)

Steps to Reproduce

I run test with the following

server.inject({
  method: "POST",
  url: "/graphql",
  payload: { query: print(documentNode), variables },
  headers: authToken
    ? { authorization: `Bearer ${authToken}` }
    : undefined
});

Expected Behavior

The tests do not timeout

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions