Closed Bug 2070982 Opened 1 month ago Closed 1 month ago

./mach build fails with "[webpack-cli] TypeError: Cannot read properties of undefined (reading 'tap')"

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox-esr140 unaffected, firefox-esr153 unaffected, firefox156 unaffected, firefox157 fixed, firefox158 fixed)

RESOLVED FIXED
158 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox-esr153 --- unaffected
firefox156 --- unaffected
firefox157 --- fixed
firefox158 --- fixed

People

(Reporter: dholbert, Assigned: ahochheiden)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 external files)

STR:

  1. Have this mozconfig (not sure yet if any of it is necessary to trigger the issue; it just happens to be what I'm using):
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-artifact
mk_add_options AUTOCLOBBER=1
ac_add_options --enable-artifact-builds
  1. Run ./mach build

ACTUAL RESULTS:
Build fails, with this warning (W) and error (E) output:

 0:21.93 Elapsed: 0.00s; From /scratch/work/builds/git-firefox/obj-artifact/dist/bin/moz-src/toolkit/modules: Kept 0 existing; Added/updated 7; Removed 0 files and 0 directories.
 0:22.44 W [webpack-cli] TypeError: Cannot read properties of undefined (reading 'tap')
 0:22.44 W     at BannerPlugin.apply (/scratch/work/builds/git-firefox/firefox/third_party/node/node_modules/webpack/lib/BannerPlugin.js:85:27)
 0:22.44 W     at createCompiler (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/webpack.js:76:12)
 0:22.44 W     at /scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/webpack.js:44:48
 0:22.44 W     at Array.map (<anonymous>)
 0:22.44 W     at createMultiCompiler (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/webpack.js:44:33)
 0:22.44 W     at create (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/webpack.js:134:16)
 0:22.44 W     at webpack (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/webpack.js:151:47)
 0:22.44 W     at WebpackCLI.f [as webpack] (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack/lib/index.js:72:16)
 0:22.44 W     at WebpackCLI.createCompiler (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack-cli/lib/webpack-cli.js:2191:23)
 0:22.44 W     at async WebpackCLI.runWebpack (/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/node_modules/webpack-cli/lib/webpack-cli.js:2321:16)
 0:22.45 E Traceback (most recent call last):
 0:22.45 E   File "<frozen runpy>", line 198, in _run_module_as_main
 0:22.45 E   File "<frozen runpy>", line 88, in _run_code
 0:22.45 E   File "/scratch/work/builds/git-firefox/firefox/python/mozbuild/mozbuild/action/file_generate.py", line 156, in <module>
 0:22.45 E     sys.exit(main(sys.argv[1:]))
 0:22.45 E              ~~~~^^^^^^^^^^^^^^
 0:22.45 E   File "/scratch/work/builds/git-firefox/firefox/python/mozbuild/mozbuild/action/file_generate.py", line 100, in main
 0:22.45 E     ret = module.__dict__[method](
 0:22.45 E         output, *args.additional_arguments, **kwargs
 0:22.45 E     )
 0:22.46 E   File "/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/build-newtab-bundles.py", line 127, in generate_js
 0:22.46 E     _run(
 0:22.46 E     ~~~~^
 0:22.46 E         [
 0:22.46 E         ^
 0:22.46 E     ...<9 lines>...
 0:22.46 E         extra_env={"MOZ_WEBPACK_DEPS": deps_file},
 0:22.46 E         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 0:22.46 E     )
 0:22.46 E     ^
 0:22.46 E   File "/scratch/work/builds/git-firefox/firefox/browser/extensions/newtab/build-newtab-bundles.py", line 113, in _run
 0:22.46 E     raise Exception(f"{argv[1]} failed with exit code {result.returncode}")
 0:22.47 E Exception: /scratch/work/builds/git-firefox/firefox/third_party/node/node_modules/webpack/bin/webpack.js failed with exit code 2
 0:22.48 E gmake[4]: *** [Makefile:4479: /scratch/work/builds/git-firefox/obj-artifact/browser/extensions/newtab/data/content/.deps/vendor.bundle.js.stub] Error 1
 0:22.48 E gmake[4]: *** Waiting for unfinished jobs....

I'm on Ubuntu 26.04.

This issue started with bug 2065363's commits, which landed earlier today and added the BannerPlugin.js file (for example) that's listed in the error output.

If I check out a commit from before that bug landed -- e.g. https://github.com/mozilla-firefox/firefox/commit/a21581710910 -- then I can build successfully.

I tried running ./mach bootstrap in case this bug was just a sign that I needed to update some piece of my toolchain, but it didn't help.

rm -rf browser/extensions/newtab/node_modules should fix it. Should only happen once for anyone that ran specific new tab commands.

Yup, confirmed -- that folder-deletion did fix the issue for me (and yes, I have run specific new-tab engineering commands in the past). Thanks!

(Not sure whether to consider this "fixed" or not; I'll let you close in whatever way makes sense.)

Assignee: nobody → ahochheiden
Status: NEW → ASSIGNED
Duplicate of this bug: 2071041
Pushed by ahochheiden@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5532ce94aeb4 https://hg.mozilla.org/integration/autoland/rev/31348f2f36eb Keep webpack-cli from switching to a webpack-cli under browser/extensions/newtab/node_modules r=mconley

Set release status flags based on info from the regressing bug 2065363

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch

The patch landed in nightly and beta is affected.
:ahochheiden, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(ahochheiden)

It's possible somebody will hit this on beta, an uplift wouldn't hurt.

Flags: needinfo?(ahochheiden)
Attachment #9640863 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: None for users, the change only affects the build. Developers who ever ran the newtab npm commands have a stale browser/extensions/newtab/node_modules, and on beta ./mach build then fails with [webpack-cli] TypeError: Cannot read properties of undefined (reading 'tap').
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: One environment variable added to the webpack-cli subprocess environment.
  • String changes made/needed?: None.
  • Is Android affected?: no

fwiw i can confirm that rm -rf browser/extensions/newtab/node_modules fixes my builders, they're slowly all coming back green (beta,central..)

Attachment #9640863 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: