Processing binary data and mapping object values

Hey folks :wave:t2:

I’m new to n8n so please forgive me if this question seems too obvious for you guys. I’m using the cloud version on the free trial, so total noob here :stuck_out_tongue:

In my last step of the workflow I’d like to upload the resulting files from the previous node to a bucket in Google Cloud Storage - but I’m unable to map the filenames to the Object Name property.

I’ve attempted to use an expression, but probably I’m not using it right. Here’s the screenshot:

Last thing, the data (besides the filename issue) is being sent successfully when testing, however, I’ve noticed the file is not being processed correctly. The file size is wrong and the data isn’t there.

Although the binary data in the previous step looks fine to me.

In summary:

  • How can I map the values from the previous step into the Object Name property?

  • Am I missing something in the binary properties to successfully store the files without any data loss?

Hope someone can shed some light in here

Regards

Welcome to the community @Javier_Vinas !

That is actually really not that obvious as we do not have the drag & drop mapping there yet. It should be:

{{ $binary.data.fileName }}

And make sure to change the parameter to expression.

1 Like

Hi @jan! Thank you so much for your answer.

It worked! :raised_hands:t2:

However, I still have the issue that the file is not properly uploaded to Google Cloud Storage. The file size is 7B and it comes empty. I’ve tried to map the binary data too with the expression:

{{ $binary.data.fileSize }}

but that throws me an error.

Most likely I’m missing something on the “binary property” option.

Appreciate some help on this

1 Like

Hi! I am with a similiar problem, but i need to use the 2 items at the same time. How could i make it work?

hey! try to put just data.

Yes, because nodes in n8n run once for each input item, if you pass in two items which each have a binary file they will both be uploaded.

@Javier_Vinas for “Binary Property” try just adding data (but in “Fixed” mode not in “Expression”).

It’s a bit confusing so a quick “why” :point_down:

  • “Property” = “key” or “name”
  • On the left you see in orange the word “data” at the top of each binary file. this is the “property” (or “name”), i.e. how you reference that binary file. By default, most nodes will assign a property name of data
  • We now have the functionality that when you drag and drop a datapill on a node parameter that expects key name (not an expression), it will automatically pick the key name and insert that. However we don’t yet have drag + drop mapping support for binary data; thus the confusion.

Good news is, a colleague of mine is working to refactor the UX of working with binary data in n8n and it should be a lot more intuitive :slight_smile:

1 Like

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