Skip to main content
Version: v5.1.x

Warnings

Table of contents

Warnings

Warnings In Fastify

Fastify utilizes Node.js's warning event API to notify users of deprecated features and known coding mistakes. Fastify's warnings are recognizable by the FSTWRN and FSTDEP prefixes on warning code. When encountering such a warning, it is highly recommended that the cause of the warning be determined through use of the --trace-warnings and --trace-deprecation flags. These will produce stack traces pointing out where the issue occurs in the application's code. Issues opened about warnings without including this information may be closed due to lack of information.

In addition to tracing, warnings can also be disabled. It is not recommended to disable warnings as a matter of course, but if necessary, they can be disabled by using any of the following methods:

  • setting the NODE_NO_WARNINGS environment variable to 1
  • passing the --no-warnings flag to the node process
  • setting 'no-warnings' in the NODE_OPTIONS environment variable

For more information on how to disable warnings, see node's documentation.

However, disabling warnings is not recommended as it may cause potential problems when upgrading Fastify versions. Only experienced users should consider disabling warnings.

Fastify Warning Codes

CodeDescriptionHow to solveDiscussion
FSTWRN001The specified schema for a route is missing. This may indicate the schema is not well specified.Check the schema for the route.#4647
FSTWRN002The %s plugin being registered mixes async and callback styles, which will result in an error in fastify@5.Do not mix async and callback style.#5139

Fastify Deprecation Codes

Deprecation codes are further supported by the Node.js CLI options:

CodeDescriptionHow to solveDiscussion