Help Needed: PDF Webhook to Gmail Attachment Error

My Workflow

I’ve created a workflow with the following nodes:

  1. Webhook (receiving a PDF file)
  2. Extract from File node (PDF)
  3. AI Agent
  4. Gmail (to send the PDF as an attachment)

The Problem

When I try to run this workflow, I get the following error at the Gmail node:

Cannot read properties of undefined (reading '0') (item 0)

What I’ve Tried

  • I can see the PDF file in binary data from the webhook
  • I’ve set the binary name in the Gmail attachment field
  • The Extract from File node seems to be working correctly

Details

  • The PDF is successfully received by the webhook
  • The Extract from File node processes the PDF
  • When the data reaches the Gmail node, it fails with the error

My Questions

  1. Why am I getting this error if the binary data is visible from the webhook?
  2. How should I properly configure the Gmail node to use the PDF as an attachment?

Any help would be greatly appreciated! Thank you.

Using n8n self hosting.

Please share your workflow. Select all relevant elements on canvas, Ctrl/Cmd-C, then paste it in your post using </> button.

Okay, this is my workflow, please help:

Hi sir, could you help me to solve my question? About sending an attachment using Gmail

Hi @ashafizullah , my apologies, missed this one.
I can be wrong but I do not think AI agent is able to bypass binary files to its tools.
There is also no way to refer to an earlier node as Gmail node expects a field name as a literal.
I’d suggest using the Structured Output Parser tool to get data from the AI Agent and wire Merge and Gmail nodes after an AI node where you’d be able to attach a binary.
Below is a wireframe of what you’d be looking for. I didn’t tune any nodes for your use case. It is just to give an idea of what a workaround would be.

Hope this helps.

1 Like

Thank you so much. Its working!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.