Cloud Storage Node returns 400

Hi, I fetch an email attachment from an imap server (that works) and I want to upload it to my cloud storage (the connection works) - but when I do so I returns this error:

ERROR: Request failed with status code 400
21.8.2023, 15:05:41
NodeApiError: Request failed with status code 400
    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:114:23)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:686:23)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:631:53


Hi sorry for pushing it - anyone an idea from the n8n team?
Thank you!

OK I found the error - the problem is my file name:
BSVereinbarung {{ }}

only {{ }} is working fine.

How can I concat a string with this expression language?

Hey @pfiadDi,

Normally what you have would do the job which you can see in the image below your expression, Have you tried removing the space to see if that works?

1 Like

No I haven’t - I solved it now this way:
{{ +“.txt” }}

But yeah I think you are right, the problem is the space - now after Googleing Naming convention I found this:

What is the naming convention for Cloud Storage?

Bucket names. Your bucket names must meet the following requirements: Bucket names can only contain lowercase letters, numeric characters, dashes ( - ), underscores ( _ ), and dots ( . ). Spaces are not allowed.

1 Like

That is good to know, Your solution with the + works as well but if you didn’t want that you can just do {{ }}.txt

Nope now it doesn’t work anymore …^^ unbelievable. It worked with 1.1 and now with 1.3.1 this morning not anymore:

This works:

  • fixed.txt
  • {{ “fixed.txt”}}
    but none combination with - even“” which just returns a number doesn’t work and it worked for sure yesterday night

Ok I just realized that I can’t roll back in the hosted version so I can’t try if 1.3.1 is actually the reason

So this also works:
{{ $json.metadata[‘x-exclaimerimprintlatency’] }}.txt

but $now+“.txt” or".txt doesn’t so I really think that is a bug with 1.3.1 maybe the Function gets a space added in the request or it transforms it in some ways

This also fails: {{ Math.round(Math.random()*100) }}
in short it seems all functions fails

@Jon (added you - I wasn’t sure you get the replies when I don’t mention you)

is it the same error?

Yes a 400 - and that’s really a problem now because the files I received as well as the email are always the same subject name etc. So I need some kind of randomness in the filename for the bucket or I overwrite them. timestamp would be ok as well as a random number

I will take a look shortly.

Thank you I found a workaround for now - I add a code node inbetween and adde a field “fileName” to the json based on the timestamp and use this field in the cloud storage node as filename. that works again.

1 Like

I want to confirm the problem persists.

Hey @honzapav,

In your case what is the filename you are sending and which version of n8n are you using?

This doesn’t work → {{ "rsj_" + $now.toMillis() + "." + $ }}
This also doesn’t work → rsj_{{ $now.toMillis() }}.{{ $ }}.
This works → {{ $ }}

What happens if you manually try something like rsj_{{$now.toMillis()}}.pdf (assuming it is a PDF) does that work?

I cannot replicate it quickly now, but in another workflow, this works → {{ $node.setBody.json.filename }}.pdf (I know it is not the same, but I need to leave the screen now :evergreen_tree::evergreen_tree::evergreen_tree:) :slight_smile: Hope it helps.

1 Like

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