serverless-bundle icon indicating copy to clipboard operation
serverless-bundle copied to clipboard

Webpack error when using v5.0.0

Open bernier opened this issue 3 years ago • 20 comments

`WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.module.rules[1].resolve has an unknown property 'fullySpecified'. These properties are valid: object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, ignoreRootsErrors?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, preferAbsolute?, resolver?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }`

serverless offline won't start because of this error

My quick fix was to comment out the following inside src/webpack.config.js What would be a final fix? Thanks

// { // test: /\.mjs$/, // include: /node_modules/, // type: "javascript/auto", // resolve: { // fullySpecified: false, // }, // },

bernier avatar Aug 24 '21 17:08 bernier

Went back to v4.4.0 due to this issue. Even if I can make it work locally using the hack mentioned above, the CI/CD doesn't like it.

bernier avatar Aug 27 '21 16:08 bernier

Thanks Bernie! Any news on fixing this without downgrading?

bros4president avatar Oct 08 '21 20:10 bros4president

I might be mistaken but this was fixed in: https://github.com/AnomalyInnovations/serverless-bundle/releases/tag/v5.0.2

jayair avatar Oct 08 '21 21:10 jayair

Thanks @jayair I'll take a look and close the ticket if it's the case

bernier avatar Oct 28 '21 16:10 bernier

@jayair no, still the same issue after upgrading to 5.0.2

`Serverless: Bundling with Webpack...

Webpack Options Validation Error ------------------------

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.module.rules[1].resolve has an unknown property 'fullySpecified'. These properties are valid: object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, ignoreRootsErrors?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, preferAbsolute?, resolver?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? } -> Options for the resolver at webpack (/Users/alex/Projects/serverless-project/node_modules/webpack/lib/webpack.js:31:9)`

bernier avatar Oct 29 '21 21:10 bernier

@jayair not sure if it helps

 Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              16.13.0
     Framework Version:         2.64.1 (local)
     Plugin Version:            5.5.0
     SDK Version:               4.3.0
     Components Version:        3.17.1

bernier avatar Nov 02 '21 18:11 bernier

Same here

rodrigogs avatar Nov 06 '21 06:11 rodrigogs

This issue is not related the the one fixed in 5.0.2. I think the solution for this case is to use enforceExtension instead of using fullySpecified here

ghostnumber7 avatar Nov 15 '21 21:11 ghostnumber7

@ghostnumber7 Oh I see. Feel free to submit a PR with a test case and I'll merge it. Thanks!

jayair avatar Nov 15 '21 22:11 jayair

After some more digging, it seams that fullySpecified was added here on July 17 (and can't see exactly which version does have it for the first time). Maybe updating webpack version would do the trick (was wrong in the previous comment). Configuration does exist, so only thing I can think of is having an old version of webpack that matches the version we specify but does not have that property

ghostnumber7 avatar Nov 16 '21 02:11 ghostnumber7

Any news? Don't mean to be pushy but this issue has been opened in August and hasn't been resolved. The issue is still happening with the latest version 5.2.0. Thanks

bernier avatar Dec 13 '21 17:12 bernier

I haven't had a chance to dig into this. Feel free to open a PR with a fix and I'll take a look right away.

jayair avatar Dec 13 '21 18:12 jayair

I totally gave up on updating this library. It does not work properly since 5.0.

rodrigogs avatar Dec 13 '21 18:12 rodrigogs

I started a new project and started digging a little more through my base files.

I might have been resolved this issue by doing:

npm list webpack
npm remove cache-loader

Basically, npm list webpack will list the versions of webpack used by the project. Another version of webpack was installed for cache-loader and was probably conflicting with the one used by serverless-bundle

I'm now able to use serverless-bundle 5.3.0

bernier avatar Feb 17 '22 23:02 bernier

hey, so, just found this project. seems like it's currently broken? nobody answered this so question either...

I'll just downgrade to 4.x I guess. It's a shame that this simple webpack flag seems to be impossible to add.

yspreen avatar Feb 27 '22 18:02 yspreen

Please feel free to open a PR!

jayair avatar Feb 28 '22 16:02 jayair

In the docs you specifically say that you believe all webpack configs are covered and if anything's missing just to create a github issue 😅

this has been open for 7 months now. I agree, I should just open the PR myself, but I sadly don't have the time. will have to stick to 4.x for now :(

yspreen avatar Mar 01 '22 07:03 yspreen

@jayair if I were to create a PR it would be for the missing functionality to override forceExclude. bc some layers (see https://github.com/fusebit/everynode/issues/3 ) don't have the SDK included

yspreen avatar Mar 01 '22 07:03 yspreen

Yeah if the PR describes what the fix is and has some tests that would be great.

jayair avatar Mar 01 '22 20:03 jayair

@jayair @yspreen please refer to the solution I used to fix the issue on my end. You might be able to do something similar. If not feel free to open a PR https://github.com/AnomalyInnovations/serverless-bundle/issues/259#issuecomment-1043621908

bernier avatar Mar 01 '22 22:03 bernier