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.

Do not activate polyfills automatically when using Apollo Server.

See original GitHub issue

when using node10, the method Array.flat does not exist. but, if i require apollo-server-express first, then it suddenly starts to exist.

try this example code:

console.log([].flat);
require('apollo-server-express');
console.log([].flat);

if you run it with node10, you get:

undefined
[Function: flat]

what i would like to happen is:

undefined
undefined

a module should not modify the global namespace.

seems a polyfill gets activated. i started to dig into the dependencies-tree, and it seems it goes:

apollo-server-express
  > apollo-server-core
    > @apollographql/apollo-tools
      > apollo-env
        > core-js

so technically apollo-env is the one that activates the polyfill, but i do not know what that module does or why is it used, so i decided to create the bugreport here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jlogsdoncommented, Dec 9, 2020

We just wasted 2 hours tracking down an issue that was exactly this. What’s the status of ripping out the polyfill behavior? It’s honestly unacceptable for a runtime library.

0reactions
alexanderniebuhrcommented, May 27, 2021

@glasser can we get an v3 alpha release of apollo-server-core on npm with #5244 merged. Or can you tell me how to bundle it locally, so we can use it in our custom cloudflare workers integration, which currently fails because of this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating to Apollo Server 4 - Apollo GraphQL Docs
If you are using apollo-server-express 's default /graphql URL path (i.e., not specifying another URL with the path option), you can mount expressMiddleware ......
Read more >
React, Apollo-server url problem - Help
Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: -...
Read more >
API Reference: ApolloServer - Apollo GraphQL Docs
Under the hood, Apollo Server automatically generates this field from ... If you're using startStandaloneServer you do not need to start your server...
Read more >
Configuring CORS - Apollo GraphQL Docs
Control access to your server's resources.
Read more >
Subscriptions in Apollo Server - Apollo GraphQL Docs
Subscriptions are not supported by Apollo Server 4's startStandaloneServer function. To enable subscriptions, you must first swap to using the ...
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