Binary from Google Drive not working in HTTP Request (Gemini inlineData)

Hi,

I’m trying to send a PDF downloaded from Google Drive (Download operation) to Google Gemini API using inlineData in an HTTP Request node.

Flow:
Google Drive → Download → Code node (preserving binary) → HTTP Request

Binary is visible in the Binary tab of the previous node.

In HTTP Request I’m using Expression:

={{
  contents: [
    {
      parts: [
        { text: "Extract text" },
        {
          inlineData: {
            mimeType: $binary.data.mimeType,
            data: $binary.data.data
          }
        }
      ]
    }
  ]
}}

But Gemini returns:
“The document has no pages”

So it seems the PDF is not being received correctly.

Questions:

  • Is HTTP Request safe for sending large base64 inline?

  • Should I use Form-Data instead?

  • Is there a known issue with binary propagation through Code node?

  • Is there a recommended way to send binary to external APIs in n8n?

n8n version: 2.8.3
Deployment: Self-hosted (VPS]