When used standalone, undici sends a value of 'undici' in it's User-Agent header. When it's bundled for upstream NodeJS, the bundler makes a slight modification to the code so that it uses 'node' as the value of User-Agent. The relevant line of code seems to be in `lib/fetch/index.js`: > httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') The `build:node` script uses the `--define esbuildDetection=1` flag for it's invocation of esbuild, so that in the output .js file, the above line is changed to the following: > httpRequest.headersList.append('user-agent', false ? 'undici' : 'node') Since we use the new way of loading WASM files via dedicated loader, this step is skipped and 'undici' User-Agent used. Reproducible: Always
CC @fedora as the original author of the loader: Any suggestions on what to change to carry the user-agent switch even to our way of providing the NodeJS builtin?
a) replace all match of `esbuildDetection` to `1` at build stage (since that's all what esbuild does) b) add `globalThis.esbuildDetection = 1` to `loader.js`
b), however, will pollute the global namespace, so I think the better way forward is to patch this line / replace it at build stage
An alternative approach is to submit a patch to upstream that isolated this inline detection to a module-wide variable, and do `delete globalThis.esbuildDetection` after requiring the module.
FEDORA-2024-8aa53b5575 (nodejs-undici-5.28.3-2.fc40) has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2024-8aa53b5575
FEDORA-2024-8aa53b5575 (nodejs-undici-5.28.3-2.fc40) has been pushed to the Fedora 40 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2024-d372314327 (nodejs-undici-5.28.3-2.fc39) has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2024-d372314327
FEDORA-2024-963ecc9459 (nodejs-undici-5.28.3-2.fc38) has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2024-963ecc9459
FEDORA-2024-963ecc9459 has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-963ecc9459` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-963ecc9459 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2024-d372314327 has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-d372314327` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-d372314327 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2024-963ecc9459 (nodejs-undici-5.28.3-2.fc38) has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2024-d372314327 (nodejs-undici-5.28.3-2.fc39) has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report.