Skip to content

Unuseful stack trace and a blob of text in the console with built-in logger #97

@Extarys

Description

@Extarys

You have already researched for similar issues?

Yup

What are you trying to achieve or the steps to reproduce?

I left yesterday without testing my code and this morning I have an error. I believe it is a schema/validation error, but no useful path for me to find where that error is.

What was the result you received?

I had to paste in in Xed and make some lines because the built-in fastify logging tool is a mess.

{"level":50,"time":1564937914197,"pid":2024,"hostname":"ryzenfromthedead","msg":"undefined unsupported","stack":"Error: undefined unsupported\n    at build (/srv/fastify/node_modules/fast-json-stringify/index.js:114:13)\n    at getValidatorForStatusCodeSchema (/srv/fastify/node_modules/fastify/lib/validation.js:14:10)\n    at /srv/fastify/node_modules/fastify/lib/validation.js:20:21\n    at Array.reduce (<anonymous>)\n    at getResponseSchema (/srv/fastify/node_modules/fastify/lib/validation.js:19:22)\n    at build (/srv/fastify/node_modules/fastify/lib/validation.js:55:31)\n    at Object.afterRouteAdded (/srv/fastify/node_modules/fastify/lib/route.js:215:11)\n    at after (/srv/fastify/node_modules/fastify/lib/route.js:159:25)\n    at Object._encapsulateThreeParam (/srv/fastify/node_modules/avvio/boot.js:419:7)\n    at Boot.callWithCbOrNextTick (/srv/fastify/node_modules/avvio/boot.js:341:5)\n    at Boot._after (/srv/fastify/node_modules/avvio/boot.js:232:26)\n    at Plugin.exec (/srv/fastify/node_modules/avvio/plugin.js:89:17)\n    at Boot.loadPlugin (/srv/fastify/node_modules/avvio/plugin.js:175:10)\n    at Task.release (/srv/fastify/node_modules/fastq/queue.js:127:16)\n    at worked (/srv/fastify/node_modules/fastq/queue.js:169:10)\n    at toLoad.finish (/srv/fastify/node_modules/avvio/plugin.js:178:7)","type":"Error","v":1}
[nodemon] app crashed - waiting for file changes before starting...

Now in a readable format:

"Error: undefined unsupported
    at build (/srv/fastify/node_modules/fast-json-stringify/index.js:114:13)
    at getValidatorForStatusCodeSchema (/srv/fastify/node_modules/fastify/lib/validation.js:14:10)
    at /srv/fastify/node_modules/fastify/lib/validation.js:20:21
    at Array.reduce (<anonymous>)
    at getResponseSchema (/srv/fastify/node_modules/fastify/lib/validation.js:19:22)
    at build (/srv/fastify/node_modules/fastify/lib/validation.js:55:31)
    at Object.afterRouteAdded (/srv/fastify/node_modules/fastify/lib/route.js:215:11)
    at after (/srv/fastify/node_modules/fastify/lib/route.js:159:25)
    at Object._encapsulateThreeParam (/srv/fastify/node_modules/avvio/boot.js:419:7)
    at Boot.callWithCbOrNextTick (/srv/fastify/node_modules/avvio/boot.js:341:5)
    at Boot._after (/srv/fastify/node_modules/avvio/boot.js:232:26)
    at Plugin.exec (/srv/fastify/node_modules/avvio/plugin.js:89:17)
    at Boot.loadPlugin (/srv/fastify/node_modules/avvio/plugin.js:175:10)
    at Task.release (/srv/fastify/node_modules/fastq/queue.js:127:16)
    at worked (/srv/fastify/node_modules/fastq/queue.js:169:10)
    at toLoad.finish (/srv/fastify/node_modules/avvio/plugin.js:178:7)","type":"Error","v":1}

What did you expect?

A useful error with a path I can use to find the error and a readable stacktrace.
How can I find which file has the error?

Context

  • node version: v10.16.0
  • fastify version: 2.7.1
  • os: Mac, Windows: Linux
  • any other relevant information:

Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed,
locked, and assigned the missing discussion label.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions