@microsoft/azure-data-factory-utilities fails with downloaded main.js

Bánhidy Attila 20 Reputation points
2026-08-26T06:37:38.2966667+00:00

Hi,

I've found a similar problem here: https://learn.microsoft.com/en-us/answers/questions/1483654/@microsoft-azure-data-factory-utilities-fails-to-d.

My company's network is highly restricted, so the pipeline is not able to download the main.js file.

What I did:

Downloaded the file manually from: https://adf.azure.com/assets/cmd-api/main.js

Added it to the pipeline repository.

My package.json looks like this because I can only download the utility package from our Nexus repository:

JSON

{
 "scripts": {
 "build": "node node_modules/@microsoft/azure-data-factory-utilities/lib/index"
 },
 "dependencies": {
 "@microsoft/azure-data-factory-utilities": "^1.0.0"
 }
}

The installed version is 1.0.3.

The installed Node version is: 20.11.0

The utility package is installed locally, not globally.

I also patched bundle.manager.js:

JSON

set -euo pipefail

BUNDLE_FILE="$(Build.SourcesDirectory)/node_modules/@microsoft/azure-data-factory-utilities/lib/bundle.manager.js"

sed -i "s|if (!fs.existsSync(BundleManager.defaultBundleDir)) {|this._runCommand('$(Build.SourcesDirectory)/_scripts/AdfPublishTool/main.js', args); return;\\
if (!fs.existsSync(BundleManager.defaultBundleDir)) {|g" "$BUNDLE_FILE"

grep -n "_scripts/AdfPublishTool/main.js" "$BUNDLE_FILE"

I also tried using the --path option to specify the location of my downloaded main.js file. However, when NOT using --path, the process still attempts to download main.js, which is not possible in our environment. If I use the --path flag, the setting going to be duplicated in the command.

At this point I am quite confused about what the correct solution should be. I have already spent several days trying to solve this issue, but I still have not managed to get it working.

...to be honest, the main question would be: how can I solve, without any patch or package related file modification, that process not try to download main.js file, instead use mine downloaded main.js file... If I added --path flag to npm run build (or start) command after it, tried to download the main.js file...what is not possible...

The error what I get:

Error: Command failed: node /home/agent/azp/_work/1/s/_scripts/AdfPublishTool/main.js validate /home/agent/azp/_work/1/s/Datafactory /subscriptions/xxx-xxx-xxx/resourceGroups/az-rg/providers/Microsoft.DataFactory/factories/yyyy  /home/agent/azp/_work/1/s/_scripts/AdfPublishTool/main.js:1

If you need any additional information and it is not sensitive, I will gladly provide it.

Any help would be greatly appreciated.

Thanks!

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


Answer accepted by question author
Allan Solomon Mejia 7,585 Reputation points
2026-08-26T20:02:35.2066667+00:00

Hello @Bánhidy Attila

Based on the latest error, the --path option is working correctly.

Your log shows:

node /home/agent/.../_scripts/AdfPublishTool/main.js validate ...

So @microsoft/azure-data-factory-utilities is executing your local main.js rather than failing because it cannot download the bundle.

Microsoft documents --path specifically for this scenario: when the build environment cannot download the bundle because of network/proxy restrictions, you can provide an existing downloaded bundle directly.

The command should therefore remain in this form:

npm run build -- --path "/path/to/main.js" validate \
  "/path/to/Datafactory" \
  "/subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.DataFactory/factories/<factoryName>"

and for export:

npm run build -- --path "/path/to/main.js" export \
  "/path/to/Datafactory" \
  "/subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.DataFactory/factories/<factoryName>" \
  "ArmTemplateOutput"

I would remove the bundle.manager.js modification completely. Patching files under node_modules isn't necessary when using the supported --path option and makes troubleshooting harder.

The remaining:

Execution failed with exit code: 1 is now a different issue. Unfortunately, the useful error from main.js isn't visible in the output you've posted.

The earlier ERR_CHILD_PROCESS_STDIO_MAXBUFFER is also important because it indicates the child process generated more stderr output than the wrapper could retain. That may be hiding the actual ADF validation error.

As the next test, run the downloaded bundle directly, bypassing the npm utility wrapper:

node --trace-uncaught "/path/to/main.js" validate \
  "/path/to/Datafactory" \
  "/subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.DataFactory/factories/<factoryName>"

This should expose the actual validation exception rather than only bundle.manager.js

Execution failed with exit code: 1

Also verify that the manually downloaded file is actually JavaScript and wasn't replaced by a proxy/authentication/error page:

file "/path/to/main.js"

head -c 100 "/path/to/main.js"

wc -c "/path/to/main.js"

So at this stage, I wouldn't troubleshoot Internet access anymore. Your local bundle is being selected successfully. The next objective is to capture the actual exception generated by main.js during validation.

Sharing this reference with you:

Automated publishing for Azure Data Factory CI/CD

If the direct node --trace-uncaught main.js validate ... command returns an error, please post the final exception/stack trace (with subscription/resource details redacted). That should identify the actual remaining problem.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.