#7092·nango

addQueryParams drops all but the last value of an array query param (set vs append)

Author: contactjawadCreated Aug 12, 2026Updated Sep 27, 2026
LabelsStale

Bug

addQueryParams in @nangohq/node builds array-valued query params with URLSearchParams.set inside a loop, so every value except the last is overwritten.

packages/node-client/lib/utils.ts:

typescript
Object.entries(queries).forEach(([name, value]) => {
    if (Array.isArray(value)) {
        for (const el of value) {
            url.searchParams.set(name, el);   // set() replaces -> only the last element survives
        }
    } else if (value !== null && value !== undefined) {
        url.searchParams.set(name, value);
    }
});

URLSearchParams.set() replaces all existing values for a key, so looping over an array leaves only the final element.

Reproduce

javascript
const url = new URL('https://api.nango.dev/providers');
// same loop as addQueryParams:
for (const el of ['a', 'b', 'c']) url.searchParams.set('ids', el);
console.log(url.search); // "?ids=c"  (expected "?ids=a&ids=b&ids=c")

This is reachable from the public SDK: e.g. getIntegration(..., { include: ['webhook', 'credentials'] }) — whose include is typed as an array — sends only ?include=credentials, so webhook is silently dropped.

Expected

All array elements should be sent as repeated params (?ids=a&ids=b&ids=c).

Fix

Use append instead of set in the array branch (the sibling helper in packages/node-client/lib/index.ts already uses usp.append('ids', id) for arrays):

typescript
for (const el of value) {
    url.searchParams.append(name, el);
}

Happy to help however is useful.