Variables passed in the URL are not always initialized in bulk HTTP requests

Hello n8n community,

I stumbled upon a problem with the “HTTP request” node. When handling bulk HTTP requests with a URL that is based on a variable, the first request is correctly performed (meaning the variable is present in the URL); however, in all the subsequent calls the variable “disappears” from the URL. Could you please look into that ? I have attached the workflow as well as the requests sent. If you need more information, please let me know :wink:

I am attaching the log from the HTTP request node. As you can notice, during the first request, the URL is correctly set up (with the id: ~42242240), but this is not the case of the second request.

    REQUEST {
        headers: { accept: 'application/json,text/*;q=0.99' },
        method: 'GET',
        uri: 'https://www.google.com/id/~42242240',
        gzip: true,
        rejectUnauthorized: true,
        json: true,
        callback: [Function: RP$callback],
        transform: undefined,
        simple: true,
        resolveWithFullResponse: false,
        transform2xxOnly: false
    }
    REQUEST {
        headers: { accept: 'application/json,text/*;q=0.99' },
        method: 'GET',
        uri: 'https://www.google.com/id/',
        gzip: true,
        rejectUnauthorized: true,
        json: true,
        callback: [Function: RP$callback],
        transform: undefined,
        simple: true,
        resolveWithFullResponse: false,
        transform2xxOnly: false
    }

And this is the workflow

Best regards,
Laurent

Hey @laurent!

Do you want to make request to the same ID for both the documents? In the example that you shared, there is only one ID, and there is no mapping between the document and the ID.

Assuming that the question to @harshil1712 answer is “yes” you would have to change the expression:

{{$node["Function"].json["_id"]}} 

to

{{$item(0).$node["Function"].json["_id"]}}

That will then make sure to always use the id of the first item and not the id of the corresponding item (which would be for the second item, the second item of the Function node which does not exist as the Function-Node has only one item).

Hope that makes sense!

The following syntax worked for me, thank you jan :wink: