Skip to content

Cannot set headers after they are sent #259

@andreasvirkus

Description

@andreasvirkus

Currently calling

const mail = useMail()

await mail.send({
  from: 'Website',
  subject: 'Form',
  text: `${name.value}
E-mail: ${email.value}
Msg: ${message.value}`,
})

Results in a 500 error logged (only on prod), it works fine locally. Is the API_URL env still required or the axios dependency? From the docs it's hard to tell if that's only for Nuxt 2 or also for Nuxt 3

Error:

homepage-2    | [nuxt] [request error] [unhandled] [500] Cannot set headers after they are sent to the client
homepage-2    |   at ServerResponse.setHeader (node:_http_outgoing:699:11)
homepage-2    |   at setResponseHeaders$1 (./.output/server/chunks/runtime.mjs:1751:20)
homepage-2    |   at Object.handler (./.output/server/chunks/runtime.mjs:5643:7)
homepage-2    |   at Object.handler (./.output/server/chunks/runtime.mjs:2270:31)
homepage-2    |   at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
homepage-2    |   at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:2540:7)

The response of the /send/mail API endpoint in the browser's dev tools is

message: "Missing credentials for \"PLAIN\""
stack: ""
statusCode: 500
statusMessage: "Missing credentials for \"PLAIN\""
url: mail/send"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions