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

FastifyError [Error]: logger options only accepts a configuration object. #479

Closed
kaiburjack opened this issue Nov 27, 2024 · 3 comments · Fixed by #480
Closed

FastifyError [Error]: logger options only accepts a configuration object. #479

kaiburjack opened this issue Nov 27, 2024 · 3 comments · Fixed by #480
Labels

Comments

@kaiburjack
Copy link

kaiburjack commented Nov 27, 2024

🐛 Bug Report

After upgrading from 2.2.5 to 2.2.6, the service crashes with the error message:

/home/app/node/node_modules/.pnpm/@fastify+error@4.0.0/node_modules/@fastify/error/index.js:18
      return new FastifyError(...args)
             ^
FastifyError [Error]: logger options only accepts a configuration object.
    at FastifyError (/home/app/node/node_modules/.pnpm/@fastify+error@4.0.0/node_modules/@fastify/error/index.js:18:14)
    at createLogger (/home/app/node/node_modules/.pnpm/fastify@5.1.0/node_modules/fastify/lib/logger-factory.js:100:11)
    at fastify (/home/app/node/node_modules/.pnpm/fastify@5.1.0/node_modules/fastify/fastify.js:139:33)
    at createApp (/home/app/node/src/app.ts:11:15)
    at <anonymous> (/home/app/node/src/index.ts:6:13)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5) {
  code: 'FST_ERR_LOG_INVALID_LOGGER_CONFIG',
  statusCode: 500
}

Node.js v20.13.1

We are using the ducktors/turborepo-remote-cache:2.2.6 Docker Image.

To Reproduce

Steps to reproduce the behavior:

  • start the turbo repo cache using the ducktors/turborepo-remote-cache:2.2.6 Docker image e.g. via:
docker run -e TURBO_TOKEN=... ducktors/turborepo-remote-cache:2.2.6

Expected behavior

The service starts successfully as expected, just like in version 2.2.5.

Your Environment

  • OS: Linux
  • Cloud Vendor: GCP/GKE
  • Turbo Version: 2.2.6
@mattref
Copy link
Contributor

mattref commented Nov 27, 2024

This appears to be caused by the Fastify version bump, which didn't account for Fastify v5's "New logger constructor signature", which is mentioned in the migration guide.

I think line 12 in app.ts should be changed as follows:

  const app = Fastify({
-  logger,
+  loggerInstance: logger,

matteovivona added a commit that referenced this issue Nov 27, 2024
fix: logger options only accepts a configuration object #479
matteovivona pushed a commit that referenced this issue Nov 27, 2024
## [2.2.7](v2.2.6...v2.2.7) (2024-11-27)

### Bug Fixes

* change logger config ([5c7d495](5c7d495))
* logger options only accepts a configuration object [#479](#479) ([705d9bf](705d9bf))
@matteovivona
Copy link
Contributor

🎉 This issue has been resolved in version 2.2.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kaiburjack
Copy link
Author

Indeed, it works! Thanks for the very quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants