Attachments in `payload` cause Novu email trigger to fail (500 error)
When attempting to send an email using Novu with an attachment, the request fails with a
According to the Novu documentation, attachments should be passed in the
2. Pass a payload including an
3. Observe the response: 4. Remove the attachments key and re-run — email sends successfully.
500 Internal Server Error
. The same code works correctly when the attachments
object is removed from the payload.According to the Novu documentation, attachments should be passed in the
payload
under the key attachments
, but this seems to cause issues in practice.
1. Create an Astro API endpoint that calls Novu’s trigger API.2. Pass a payload including an
attachments
object, for example:3. Observe the response: 4. Remove the attachments key and re-run — email sends successfully.
9 Replies
Hi Shanil
I am Pawan from Novu
Could you please confirm if attachment variable is in form of correct format specified in this doc https://docs.novu.co/platform/integrations/email#sending-email-attachments
file field can be buffee or base64 string
I am Pawan from Novu
Could you please confirm if attachment variable is in form of correct format specified in this doc https://docs.novu.co/platform/integrations/email#sending-email-attachments
file field can be buffee or base64 string
Even though I put the same, I get the same error
Are you using novu cloud? If yes, please share the transactionId from the activity feed page for this workflow trigger
We are running a self-hosted instance of Novu. Are there any specific configurations or environment variables that need to be enabled in our setup to support this functionality?
@Pawan Jain Do we need to specify anything in the Novu email template for handling attachments?
Yes, you will need to configure a storage service like s3 to send attachments. You will see related environment variables in example env file
Hi @Pawan Jain , So can we refer - https://github.com/novuhq/novu/blob/next/docker/.env.example this file and add the below envs?
AWS
S3_LOCAL_STACK=$HOST_NAME:4566
S3_BUCKET_NAME=novu-local
S3_REGION=us-east-1
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
and we should use - localstack/localstack service at 4566 locally right ?
It worked using minio , Thanks
@Pawan Jain We are receiving a successful response from the API with the following payload:
However, emails are being delivered. If we send the payload without attachments, for example:
It works correctly, and the email is received. But when we include attachments, such as:
The API still returns a successful response, but the email is never sent.
Do we need to make any changes in the email template to support attachments?
Here’s the current email template:
@Shanil Sasikumar, you just advanced to level 1!
Shanil
Please check the api and worker service logs, if you see any error? There must be mis configuration of storage service due to which email step is failing
Please check the api and worker service logs, if you see any error? There must be mis configuration of storage service due to which email step is failing