HTTP request error when using query parameters

Hi folks,

I’m trying to fetch some data, run it through another API and then fetch some files.
So my workflow currently consists of a MySQL node and a HTTP Request node.

My HTTP request is a simple GET request with no authentication header required, but it does expect two URL / query parameters to be passed.

https://www.matecat.com/api/v2/projects/{cat_id}/{cat_pass}

I did this using an Expression in the URL and passing the two parameters, and the “preview” under the expression looks correct. Even just running the request as “fixed” (and copying the preview from the expression into the fixed value) produces the expected result.
But, when running the node with the URL set as expression and passing the two parameters I get the following error:

"status": "rejected",
"reason": {
"message": "404 - {"errors":[{"code":0,"message":"No project found."}],"data":[]}",
"name": "Error",
"stack": "Error: Request failed with status code 404 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:539:35) at endReadableNT (node:internal/streams/readable:1345:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)"
}
}

So to me it looks like when the URL is set to expression, some other character must be sent together with the params, producing a 404 error.

Is this a bug or an error in my setup?

Thanks in advance for helping me out.

Information on my setup

  • n8n version: 0.188.0
  • Database: default: SQLite):
  • Running n8n with the execution process: own(default)
  • Running n8n via Docker

Hi @Matija_Kovac, the workflow looks good to me on first sight. Is there any chance that one of the combinations of cat_id and cat_pass from your MySQL node is leading to these 404 responses from your API server? How does the data from your MySQL node look like?

Hey Tom,
thanks for the fast reply.

I was suspecting the same issue but it can’t be as I literally copy-pasted the result of the expression,
changed the URL from expression to fixed, and it worked as expected:

See: Expression and result


Produces an error

See: Changed from expression to static and used the copy-pasted result to run the request:

I also tested the data from mysql in Postman and it looks to work perfectly fine.
Feel free to test with the values in the screenshot for testing purposes.

Note: I don’t have the latest version of N8N, it’s possible this is a bug that was fixed Side question: if I Pull the latest version and rebuild my docker container am I going to lose all of my settings or is the DB/storage persistent?

Hi @Matija_Kovac, it’s important to understand that while n8n previews the request for the first item, you have 100 different items. The HTTP Request node would make a request for every single of these 100 items, so any single one of them (apart from the first one) could cause the problem.

So, in a first step you might want to narrow down the problem and process only one item at a time. Perhaps you can try something like this?

Using this approach, n8n would loop through one item at a time. This should make it easier to find out which item exactly is causing the trouble.

Hi @Matija_Kovac, I just tried out your example values and the workflow is working fine for me:

I am getting results like this:

Perhaps you can provide an example workflow using which the problem you currently have can be reproduced, even without access to your MySQL database?

1 Like

Hey Tom,

you were right! I totally thought it was going to iterate through each of the value pairs on its’ own, but the loop through the split in batches node did the trick.

I’ll continue with an Error node for those cases and the rest of my workflow for managing these files.
Really love the power of n8n!

Thanks for the awesome and super-fast support, I really appreciate it!

1 Like

Amazing, glad to hear this approach works for you. Thanks so much for confirming!

1 Like