Skip to content

Cannot read property 'Symbol(fastify.reply.isRunningOnErrorHook)' of undefined #243

@nagibyro

Description

@nagibyro

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure it has not already been reported

Fastify version

3.18.1

Plugin version

4.15.0

Node.js version

14.16.1

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

19043.1052

Description

When using reply.view with the liquidjs engine I get a TypeError: Cannot read property 'Symbol(fastify.reply.isRunningOnErrorHook)' of undefined. This error does not happen when simply returning json / not using the reply.view function. The full error is

Debugger listening on ws://127.0.0.1:9229/dab7d3c8-6eb8-440a-8acf-2539e2ffedec
For help, see: https://nodejs.org/en/docs/inspector
{"level":30,"time":1625713859326,"pid":30160,"hostname":"Tyr","msg":"Server listening at http://127.0.0.1:3000"}
{"level":30,"time":1625713859326,"pid":30160,"hostname":"Tyr","msg":"Server listening on 3000"}
{"level":30,"time":1625713862610,"pid":30160,"hostname":"Tyr","reqId":"req-1","req":{"method":"GET","url":"/","hostname":"localhost:3000","remoteAddress":"127.0.0.1","remotePort":52202},"msg":"incoming reque
st"}
(node:30160) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'Symbol(fastify.reply.isRunningOnErrorHook)' of undefined
    at Reply.send (C:\Users\Nilithus\WebstormProjects\quotey\node_modules\fastify\lib\reply.js:117:11)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
(node:30160) TypeError: Cannot read property 'Symbol(fastify.reply.isRunningOnErrorHook)' of undefined
    at Reply.send (C:\Users\Nilithus\WebstormProjects\quotey\node_modules\fastify\lib\reply.js:117:11)
(node:30160) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)

The error is in the reply.js file in the fastily lib so not sure if this is an error with point-of-view or fastify.

Steps to Reproduce

I put a copy of my error message, app code and package.json in this gist

Expected Behavior

I expect that calling reply.view not to throw a type error

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