1

Through Azure Build pipeline, I am facing surprising error of The callback was already called in loadrunner.js file. Here is the actual error from pipeline:

C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" run build:prod"
D:\a\31\s\node_modules\loader-runner\lib\LoaderRunner.js:106
            throw new Error("callback(): The callback was already called.");
                  ^
Error: callback(): The callback was already called.
    at context.callback (D:\a\31\s\node_modules\loader-runner\lib\LoaderRunner.js:106:10)
    at D:\a\31\s\node_modules\css-loader\dist\index.js:137:5
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The same checked in set code I had build earlier on January 31, 2023 and it completed build with no issues. Unfortunately at the day of production push, I got the build issue. Since then I am trying to figure out what could be the solution.

Here is the image:

Pipeline error for same set running on different dates

I tried upgrading bootstrap version to 5.0 and above, and it did build successfully but it screwed up my UI. I am using Angular version 9.2.X and bootstrap version is ^3.4.1 in my package.json file.

Someone else posted a similar loadrunner issue on Stack Overflow but the solution provided did not work for me.

Not sure if anything happen to Bootstrap ^3.4.1 working version library? I see that the same library was downloaded 1M+ times on nodejs website in last 7-10 days.

PS: I tried upgrading angular and all the libraries, after that it build successful but upgrading Angular at this time is not an option for me to proceed. What can I try next?

Updating for pipeline info (All jobs has custom command):

Cache Clean:- Task Version 1.*, command: cache clean --force

Npm update:- Task Version 1.*, command: update --force

Npm install:- Task Version 1.*, command: install --legacy-peer-deps --force

Npm build:- Task Version 1.*, command: run build:ps

Thing to note, we have upgraded our angular version from 6 to 9 and since then we have npm update command in pipeline

It passes all steps and fails at npm build

halfer
  • 19,824
  • 17
  • 99
  • 186
Mehul
  • 25
  • 6
  • Can you share the build pipeline/workflow? What node version are you using? Are you able to run the workflow commands on your dev environment? – Pieterjan Feb 21 '23 at 13:51
  • I'm sitting with the same problem. Builds (including historical builds) just stopped working on 16 Feb on Azure DevOps Pipelines. I've also tried setting "angularCompilerOptions": { "disableTypeScriptVersionCheck": true, } in my tsconfig.json Please update this post if you get to a resolution, I will do the same. – Nieldev Feb 22 '23 at 07:27

2 Answers2

1

You can try the following (which worked for me) :

  1. Add the "Node.js tool installer" as the first build step in the Agent job which contains your Angular build step. I had to make sure that it was added to the same Agent Job as the Angular build step (and not as part of the "Configure Agent" agent job), otherwise the configuration did not work correctly.

  2. Update the "Version Spec" field of the Node.js tool installer to the version of Node that you know is working locally. (run "node -v" on your local machine's console to check your version) 16.17.0

  3. Also make sure the "Check for Latest Version" is NOT checked

Hope it helps, this is a very annoying issue.

Nieldev
  • 211
  • 1
  • 10
0

Exactly same thing happen as @Nieldev. I was confirming these steps for couple of hours just to make sure everything works fine. @Nieldev hit before me :)

The default value of npm version got updated in the pipeline, in my case my successful run was using npm version 8.19.3 where as it was updated to 9.3.1 by Azure pipeline.

It took long to figure out what is causing this and after doing some research, exactly same I have done. Main resolution was to match the npm version with working version in pipeline

1.Added Node Tool Installer, switched task version to 1.*, because Task version 0.* default value was still referring to node 6
version. Task version 1.* has default value of Node version 10 and above.
 
2.Updated Version field to use specific version. In my case it was 16.19.0.

3.Definitely do not leave "Check for Latest Version" as checked

Very annoying issue, because something that works for months starts failing during production deployment, it's killing feeling.

Hope others would get some help from this post.

Mehul
  • 25
  • 6