Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): don't mix async and callback styles #9931

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

jtoar
Copy link
Contributor

@jtoar jtoar commented Jan 29, 2024

Running yarn rw serve in the v7 RC emits two warnings:

$ yarn rw serve                                         
...
(node:69556) [FSTWRN002] FastifyWarning: The redwoodFastifyWeb plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`
(Use `node --trace-warnings ...` to show where the warning was created)
(node:69556) [FSTWRN002] FastifyWarning: The redwoodFastifyAPI plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`

These seem to be because the fastify plugins are async but use the done param, which is the callback style. This PR removes the callback style in favor of the async.

I'm also removing this warn log which we've already handled on the frontend by registering a warning route for. Right now there's no correct configuration for it when both plugins are registered on the same instance, which is what we've been doing since forever, and I don't want logs to become meaningless:

{"level":40,"time":1706557821043,"pid":69556,"hostname":"evaM1.local","msg":"apiUrl is relative but there's no proxy target"}

@jtoar jtoar added the release:fix This PR is a fix label Jan 29, 2024
@jtoar jtoar added this to the v7.0.0 milestone Jan 29, 2024
@jtoar jtoar force-pushed the ds-server/dont-mix-async-and-cb-styles branch from d49e39b to 6d91c2c Compare January 29, 2024 20:08
@jtoar jtoar merged commit edfdf99 into main Jan 29, 2024
38 checks passed
@jtoar jtoar deleted the ds-server/dont-mix-async-and-cb-styles branch January 29, 2024 20:37
jtoar added a commit that referenced this pull request Jan 29, 2024
Running `yarn rw serve` in the v7 RC emits two warnings:

```
$ yarn rw serve                                         
...
(node:69556) [FSTWRN002] FastifyWarning: The redwoodFastifyWeb plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`
(Use `node --trace-warnings ...` to show where the warning was created)
(node:69556) [FSTWRN002] FastifyWarning: The redwoodFastifyAPI plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`
```

These seem to be because the fastify plugins are async but use the
`done` param, which is the callback style. This PR removes the callback
style in favor of the async.

I'm also removing this warn log which we've already handled on the
frontend by registering a warning route for. Right now there's no
correct configuration for it when both plugins are registered on the
same instance, which is what we've been doing since forever, and I don't
want logs to become meaningless:

```
{"level":40,"time":1706557821043,"pid":69556,"hostname":"evaM1.local","msg":"apiUrl is relative but there's no proxy target"}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant