fastify / fastify/fastify-nextjs

fastify.inject timeout when @fastify/nextjs is registered

Open
#748 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
558
Forks
62
Avg merge
2d 4h
Merged PRs (30d)
6

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] 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

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

### Expected Behavior

The tests do not timeout

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.