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: Invalid schema object - webpack

See original GitHub issue

Hi everyone, when I compile my application with webpack get an error on console. The problem is on this file workbox-build > build > options > partials > generate.js in this lines of code: .when('navigationPreload', { is: true, then: joi.required() }),

if remove this not have error in console.

Library Affected: workbox-build

Browser & Platform: all browsers

Console Error Error: Invalid schema object at new module.exports (mypath/node_modules/@hapi/hoek/lib/error.js:23:19) at Object.module.exports [as assert] (mypath/node_modules/@hapi/hoek/lib/assert.js:20:11) at internals.Array.concat (mypath/node_modules/@hapi/joi/lib/types/any/index.js:143:14) at internals.Array.when (mypath/node_modules/@hapi/joi/lib/types/any/index.js:436:60) at Object.<anonymous> (mypath/node_modules/workbox-build/build/options/partials/generate.js:62:45) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (mypath/node_modules/workbox-build/build/options/schema/webpack-generate-sw.js:16:25) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (mypath/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33) at Module._compile (internal/modules/cjs/loader.js:688:30)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jeffposnickcommented, Apr 21, 2020

Okay, thanks for debugging this further.

I don’t know that there’s anything actionable that we can do on the Workbox side of things to prevent this behavior—it sounds more like webpack-merge is doing something that messes with the underlying joi validation library dependency.

I’m going to close this for now unless there’s something that comes up which we could be doing differently.

0reactions
williammancocommented, Apr 21, 2020

Hello @jeffposnick!

Ok after many attempts with a fresh installation, the problem seems the package “webpack-merge”, but it’s very strange because if I change order of import, GenerateSW don’t show errors.

from (show error)

const merge = require('webpack-merge');
const { GenerateSW } = require('workbox-webpack-plugin');

to (work correctly)

const { GenerateSW } = require('workbox-webpack-plugin');
const merge = require('webpack-merge');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid configuration object. Webpack has been initialized ...
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Read more >
webpack has been initialised using a configuration object that ...
ERROR WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Read more >
Invalid configuration object. Webpack has been ... - Reddit
it throws an error: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Read more >
Build error when configuring storybook
ValidationError : Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Read more >
To v5 from v4 - webpack
Upgrade webpack 4 and its plugins/loaders · Make sure your build has no errors or warnings · Make sure to use mode ·...
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