Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Error: only one instance of babel-polyfill is allowed #358

Open
muke5hy opened this issue Jul 20, 2018 · 8 comments
Open

Error: only one instance of babel-polyfill is allowed #358

muke5hy opened this issue Jul 20, 2018 · 8 comments
Labels

Comments

@muke5hy
Copy link
Contributor

muke5hy commented Jul 20, 2018

Hi I'm getting following error. My Node version is 9.11.2

Serverless: POST /graphql (λ: graphql) Serverless: The first request might take a few extra seconds Serverless: Error while loading graphql [ 'Error: only one instance of babel-polyfill is allowed', 'at Object.<anonymous> (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/babel-polyfill/lib/index.js:10:9)', 'at Module._compile (internal/modules/cjs/loader.js:654:30)', 'at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)', 'at Module.load (internal/modules/cjs/loader.js:566:32)', 'at tryModuleLoad (internal/modules/cjs/loader.js:506:12)', 'at Function.Module._load (internal/modules/cjs/loader.js:498:3)', 'at Module.require (internal/modules/cjs/loader.js:598:17)', 'at require (internal/modules/cjs/helpers.js:11:18)', 'at Object.<anonymous> (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:128:18)', 'at __webpack_require__ (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:20:30)', 'at Object.<anonymous> (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:81:1)', 'at __webpack_require__ (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:20:30)', 'at /Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:63:18', 'at Object.<anonymous> (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/.webpack/service/handler.js:66:10)', 'at Module._compile (internal/modules/cjs/loader.js:654:30)', 'at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)', 'at Module.load (internal/modules/cjs/loader.js:566:32)', 'at tryModuleLoad (internal/modules/cjs/loader.js:506:12)', 'at Function.Module._load (internal/modules/cjs/loader.js:498:3)', 'at Module.require (internal/modules/cjs/loader.js:598:17)', 'at require (internal/modules/cjs/helpers.js:11:18)', 'at Object.createHandler (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/serverless-offline/src/functionHelper.js:35:21)', 'at handler (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/serverless-offline/src/index.js:499:40)', 'at Object.internals.handler (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/handler.js:96:36)', 'at request._protect.run (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/handler.js:30:23)', 'at module.exports.internals.Protect.internals.Protect.run (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/protect.js:64:5)', 'at exports.execute (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/handler.js:24:22)', 'at each (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/request.js:384:16)', 'at iterate (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/items/lib/index.js:36:13)', 'at done (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/items/lib/index.js:28:25)', 'at internals.Auth.payload (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/auth.js:223:16)', 'at each (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/request.js:384:16)', 'at iterate (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/items/lib/index.js:36:13)', 'at done (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/items/lib/index.js:28:25)', 'at onParsed (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/route.js:402:20)', 'at Subtext.parse (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hapi/lib/route.js:423:20)', 'at next (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/subtext/lib/index.js:45:26)', 'at Wreck.read (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/subtext/lib/index.js:242:16)', 'at finish (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/subtext/node_modules/wreck/lib/index.js:374:20)', 'at wrapped (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/hoek/lib/index.js:875:20)', 'at module.exports.internals.Recorder.onReaderFinish (/Users/mukesh/Projects/serverless-graphql/app-backend/dynamodb/node_modules/subtext/node_modules/wreck/lib/index.js:449:16)', 'at Object.onceWrapper (events.js:272:13)', 'at module.exports.internals.Recorder.emit (events.js:185:15)', 'at module.exports.internals.Recorder.emit (domain.js:440:23)', 'at finishMaybe (_stream_writable.js:636:14)', 'at endWritable (_stream_writable.js:644:3)', 'at module.exports.internals.Recorder.Writable.end (_stream_writable.js:586:5)', 'at IncomingMessage.onend (_stream_readable.js:607:10)', 'at Object.onceWrapper (events.js:272:13)', 'at IncomingMessage.emit (events.js:185:15)', 'at IncomingMessage.emit (domain.js:422:20)', 'at endReadableNT (_stream_readable.js:1106:12)' ] Serverless: Replying error in handler

@jmuenster
Copy link

I'm experiencing the same issue with the dynamodb backend and the apollo client

@seiji-fli
Copy link

resolved this by removing babel-polyfill import from dynamodb/handler

@muke5hy
Copy link
Contributor Author

muke5hy commented Jul 30, 2018

Will there be any issue if we remove it from dynamodb/handler

@sid88in
Copy link
Contributor

sid88in commented Aug 1, 2018

@muke5hy @seiji-fli can you please test it and create a PR?

@sid88in sid88in added the bug label Aug 1, 2018
@benjamin-rood
Copy link

Encountering the same error with the Twitter / app-backend/rest-api one, too.

@Gerst20051
Copy link

Gerst20051 commented Sep 4, 2018

Error: only one instance of babel-polyfill is allowed.

Also having this same issue when using serverless-dynalite.

You can see this error gets thrown in many packages.

https://github.com/search?p=2&q=_babelPolyfill&type=Code

You can see where it doesn't do this check in serverless-dynalite.

https://github.com/sdd/serverless-dynalite/blob/5883f8abcb28349cf8d78edfa2a6f9af53b297a4/index.js#L3

@cmbirk
Copy link

cmbirk commented Oct 31, 2018

+1 here with rds backend. Commenting out the babel-polyfill line fixes the issue for me

@fransafu
Copy link

That problem exists when the import of 'babel-polyfill' is in two part of your program. If you want use 'babel-polyfill' locally, put in your code a validation which filter by NODE_ENV (development or production) or remove import or require 'babel-polyfill' when pass to production

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants