Get gmail binary , but no binary?

Hi,
Objectif : catch gmails with label " correction". texte to a file.txt and attachment to Gdrive. Focusing on the gmail attachment to … somewhere.

Once in a while (manuel for now)
node Gmail :
get all ( limit 2 for now) Gmail with label “correction”
A- full → payload json/table
B- Raw → huge 4.8M, and very raw
C- Resolved → Nice ! Can be viewed or dl !
Sems ok.

But next node ( tried GDrive then simplified to only Write Binary File) says
A-if all the node “raw” :
{{$node[“Gmail”].binary.attachment_0}}
ERROR: The binary property “[object Object]” does not exist. So no file can be written!
B-only filename :
ERROR: The binary property “IMG_20220906_185019.jpg” does not exist. So no file can be written!

I tried with full
A-{{$node[“Gmail”].json[“payload”][“parts”][0][“body”][“data”]}}
B-{{$node[“Gmail”].json[“payload”][“parts”][1][“body”][“attachmentId”]}}

ERROR: No binary data set. So file can not be written!

and with raw
{{$node[“Gmail”].json[“raw”]}} which neither n8n nor me did like apparently.

a ghinary ? ghost binary file ?
need another node?

Hey @Joel_T,

I feel like there is a lot missing here but as a test can you add the google drive node after the gmail node and for the binary property just put in attachment_0 and see if that works.

Hi Jon,
Please define " feel’ and “lot”… if you mean the script is missing some nodes, yes, it is, as writen.
As past tests, it’s not working with the gmail ( hence the just plain idiot “write binary file”) but, being a ggod boy, I tried again ( actually, copied 3 times Gmail-raw, Gmail-resolved, gmail-full and binded each to a different gdrive node.in order to understand firstly where owuld be “attachment_0”. seems to be gmail-resolved.
1- If I run one of the three, the others will “unscript” even if 3 separate entities.
2- if you were meaning gmail resolved, as it seems after testing,( but I ran the others as well with the same success) it is a " ERROR: No binary data property “[object Object]” does not exists on item!"
{
“nodes”: [
{
“parameters”: {
“authentication”: “oAuth2”,
“binaryData”: true,
“binaryPropertyName”: “={{$node["Gmail-resolved"].binary.attachment_0}}”,
“name”: “=sd”,
“resolveData”: true,
“options”: {}
},
“name”: “Google Drive”,
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 1,
“position”: [
100,
420
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “11”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {}
}

Hey @Joel_T,

By a lot missing I mean what version of n8n are you running, how is it running and can you share the workflow?

Having the workflow will show what you are doing and we should be able to work from that to get it working.

as for the version, it is 0.182.0
btw, I have my previous script ( from older version) which are still visible in the open panel, but can’t be accessed…

Hey @Joel_T,

Can you try the workflow below, I have given it a test here and it works. When it comes to using binary data to upload sometimes using an expression doesn’t work so you have to just type in the incoming property name which in this case is attachment_0.

HO, that works !! Thanks.
and thanks for the explanation, wasn’t logic to me ( exception in grammar, as a french, should be used to it)
I’ll write it down on my own n8nDoc.

1 Like

Hello @Jon,

I have the same issue.

I’ve copied your workflow’s code but it return “No binary data exists on item!”.

What is missing? I’m using the [email protected] version.

Hey @TitaHerizo,

My first thought is maybe there are multiple emails and some of them don’t have any attachments. I would double check that there is binary data in all of the messages.

There are only email with attachments on this label. And I’m testing it with different filetype but no success.

Hi, I have same issue on 0.214 and 0.213 (selfhosted & Cloud):frowning:

I filtered for 1 mail, with attachment:

and the GDrive Upload still does not find the binary

I was playing with:

  • read pdf node
  • customizing gmail format
  • also split binary
    and none of them were working.

The example email has only one attachment:

I found an root cause and made a PR. @Jon I am asking you for a review and merge to fix it. :slight_smile:

2 Likes

Will check it out on Monday morning :raised_hands:

1 Like

Hey @mjasion & @TitaHerizo,

I was just looking at this one and the GMail node already has the option to get Attachments.

It looks like this is not an option that is included with the v1 node so assuming you are on a recent version of n8n you can add the GMail node again and as long as you are not using the simplify option you will be able to get the attachments.

We didn’t add it to the v1 node as any user that adds the node to a workflow will only be able to get v2, Because of this I am not sure there is a need to add it to the v1 node as well so I think we can close the PR unless there is anything else I missed.

@Jon you are right… I was using 0.214.0 on Saturday, but I copied the above example(:point_up:), which was using GmailV1. Also, the workflow on which I was learning from public templates - was also V1.

So this is an idea request: can you improve the UI of the nodes, adding information that the Gmail node is deprecated if someone is using V1? Until I checked the code, I didn’t know there were V1 and V2… :frowning:

Anyway Thanks for checking it. :blush:

Hey @mjasion,

That is a good idea, let me have a chat with our product team about it.

1 Like

I have a version 0.214.1 on docker and I don’t have that button. How to update it?

Open the node menu and add in a GMail node again.

Didn’t help. Still without button, even if I add it to new workflow.