question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: "version" is a required argument

See original GitHub issue

Bug report

What is the current behavior? My webpack setup works fine in my local environment but fails in GCP cloudbuild with an obscure error.

Step #4 - "client-built": (node:29) UnhandledPromiseRejectionWarning: Error: "version" is a required argument.
Step #4 - "client-built":     at Object.getArg (/workspace/v3/client/node_modules/webpack-sources/node_modules/source-map/lib/util.js:24:11)
Step #4 - "client-built":     at new BasicSourceMapConsumer (/workspace/v3/client/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:294:22)
Step #4 - "client-built":     at new SourceMapConsumer (/workspace/v3/client/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:22:7)
Step #4 - "client-built":     at SourceMapSource.node (/workspace/v3/client/node_modules/webpack-sources/lib/SourceMapSource.js:32:62)
Step #4 - "client-built":     at SourceMapSource.proto.sourceAndMap (/workspace/v3/client/node_modules/webpack-sources/lib/SourceAndMapMixin.js:29:18)
Step #4 - "client-built":     at getTaskForFile (/workspace/v3/client/node_modules/webpack/lib/SourceMapDevToolPlugin.js:65:30)
Step #4 - "client-built":     at /workspace/v3/client/node_modules/webpack/lib/SourceMapDevToolPlugin.js:215:20
Step #4 - "client-built":     at Array.forEach (<anonymous>)
Step #4 - "client-built":     at /workspace/v3/client/node_modules/webpack/lib/SourceMapDevToolPlugin.js:186:12
Step #4 - "client-built":     at SyncHook.eval (eval at create (/workspace/v3/client/node_modules/tapable/lib/HookCodeFactory.js:1:1), <anonymous>:12:1)
Step #4 - "client-built":     at SyncHook.lazyCompileHook (/workspace/v3/client/node_modules/tapable/lib/Hook.js:154:20)
Step #4 - "client-built":     at /workspace/v3/client/node_modules/webpack/lib/Compilation.js:1413:42
Step #4 - "client-built":     at eval (eval at create (/workspace/v3/client/node_modules/tapable/lib/HookCodeFactory.js:1:1), <anonymous>:19:1)
Step #4 - "client-built": (Use `node --trace-warnings ...` to show where the warning was created)
Step #4 - "client-built": (node:29) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Step #4 - "client-built": (node:29) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If the current behavior is a bug, please provide the steps to reproduce.

cloudbuild step:

- name: node:$_NODE_VERSION
  entrypoint: npm
  args: ['run', 'build:ci'] # with NODE_ENV=production. Skips BundleAnalyzerPlugin
  dir: "v3/client/"
  waitFor: ['css-built', 'secret-available']
  id: 'client-built'

package.json

  "scripts": {
    "build:ci": "NODE_ENV=production npm run build -- --env ci",
 }

I have a complex setup and the issue is specifically with google cloud platform’s cloudbuild service. Can someone give me hints as to how debug and resolve this issue by myself ?

Since the traceback refers to source-map, here are parts of my config that have something to do with source maps:

config extract
export default {
  mode: "production",
  devtool: "source-map",
  optimization: {
    minimizer: [
      new TerserPlugin({
        sourceMap: true, // Must be set to true if using source-maps in production
        terserOptions: {
          compress: {
            drop_console: true,
          },
          output: {
            comments: false,
          },
        },
      }),
    ]
  },
  module: { 
    rules: [{
      test: /\.css$/i,
      use: [
        {
          loader: "css-loader",
          options: {
            importLoaders: 1,
            modules: false,
            sourceMap: true,
          },
        },
      ],
    }, {
      // add source-map support
      enforce: "pre",
      test: /\.js$/,
      exclude: /node_modules/,
      loader: "source-map-loader",
    }],
  }
};

What is the expected behavior? No “UnhandledPromiseRejectionWarning” exception should be thrown.

Other relevant information: webpack version: 4.44.2 (cannot use v5 due to issues with apollo-upload-client and graphql-js) Node.js version: 14 on cloudbuild (cannot use v15 due to other errors with node-canvas+node-pre-gyp+pangocairo) Operating System: cloudbuild is using the official node docker image Additional tools:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
AdrienLemairecommented, Jan 13, 2021

I confirm that upgrading css-minimizer-webpack-plugin to the latest version fixed the issue, thanks!

0reactions
alexander-akaitcommented, Jan 12, 2021

No problems with any version of terser, so it was due css-minimizer-webpack-plugin (I think your problem here due you provide only part of configuration) or some source maps doesn’t have the version property of source-map-loader, feel free to feedback

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "version" is a required argument while building with rollup
I am not able to figure out where the version argument should go in my setup or what's wrong with my setup. Can...
Read more >
Error: "version" is a required argument - Jumpstart Pro
I just upgraded to the newest Jumpstart Pro and now I can't compile assets... $ bundle exec rake assets:precompile yarn install v1.21.1. [1/ ......
Read more >
Error The required argument 'Number' was not assigned a value
When adding a phone number in NXT, the error: "The required argument 'Number' was not assigned a value" is received and the phone...
Read more >
Synapse - error: missing required argument 'factoryId'
Synapse - error: missing required argument 'factoryId'. Case ... task for synapse workspace v2 2022-10-02T19:05:21.6901097Z Version : 2.3.0 ...
Read more >
Error: 'A required argument is invalid or not specified near ...
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found