Skip to content

Having multiple calls on request again #636

@ghost

Description

I read documentation about async handlers and hooks and that done must not be called in case of an async function.

💬 Question here

I'm having multiple calls on this request

fastify.post('/donations', postSectionHandler)
// postSectionHandler being either
    return async (req, reply, done) => {
        console.log("*************CALLED TWICE***********")
        const { body } = req
        const { error } = validationPipeLine(req)
        if (!isEmpty(error)) {
            reply.send({ message: 'Invalid request' })
        } else {
            // Files other than images are undefined
            if (!req.file) {
                reply.send({
                    message: 'Invalid request',
                    data: body,
                    error: 'file not found'
                })
            }
            let acknowledged = await insertDocument(QInstance, req, reply, null, false)
            // done()
        }
    }

Thanks in advance !

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions