Skip to content

Fastify sendFile async support? #106

@markrzen

Description

@markrzen

You have already researched for similar issues?

Yep. I may have missed something though. Hopefully not.
Closest I could come to is:
https://www.fastify.io/docs/latest/Routes/#promise-resolution

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

When trying to use async style routes and sendFile from fastify-static, the results properly goto the client, but a Promise may not be fulfilled with 'undefined'... is logged.

  fastify.get('/', async (request, reply) => {
    reply.sendFile('/html/index.html');
  });

What was the result you received?

err: {
      "type": "FastifyError",
      "message": "FST_ERR_PROMISE_NOT_FULLFILLED: Promise may not be fulfilled with 'undefined' when statusCode is not 204",
...
}

What did you expect?

No logged error.

Context

  • node version: 12.7.0
  • fastify version: 2.8.0
  • os: OSX

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