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.

Apollo Client reports "Number expected" and stops running in IE11

See original GitHub issue

Intended outcome:

Use of Apollo React client in our app, running on IE11.

I’ve created a minimal repository that demonstrates the problem:

https://github.com/tamouse/apollo-coinbase-client-showing-ie11-error

There is no special code, particularly. The app pulls in polyfills for IE11 from https://polyfill.io, which is in the public/index.html file in the repo.

Actual outcome:

The console reports the error “Number expected”:

console-showing-error

The debugger reports the following line as the source of the error:

debug-showing-error-reporting-line

How to reproduce the issue:

See demo repo at https://github.com/tamouse/apollo-coinbase-client-showing-ie11-error

Versions

$ npx envinfo@latest --preset apollo --clipboard
npx: installed 1 in 0.888s

  System:
    OS: macOS 10.14.3
  Binaries:
    Node: 8.12.0 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.5.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 72.0.3626.109
    Firefox: 63.0.3
    Safari: 12.0.3
  npmPackages:
    apollo-boost: ^0.1.28 => 0.1.28 
    react-apollo: ^2.4.1 => 2.4.1 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

3reactions
samboylettcommented, Feb 26, 2019

Yeah. Basically the Map.prototype.set polyfill is doing 1/key, and if the key is Object.create(null) it will throw “Number expected” in IE11.

			// 6. If key is -0, let key be +0.
			if (1/key === -Infinity) {
				key = 0;
			}

It looks like this is fixed in the latest version of polyfill-library, but it’s yet to be pushed to polyfill.io (https://github.com/Financial-Times/polyfill-library/commit/09ff71b1b41f7f3e283640b27193054c030b0cbb)

My temporary solution was to only polyfill exactly what I needed: https://polyfill.io/v3/polyfill.min.js?flags=gated&features=Object.entries,Object.assign. Luckily IE11 supports basic Map anyway

0reactions
tamousecommented, Feb 26, 2019

thank you, @samboylett , I think this closes the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e., operationName ), or if the named operation...
Read more >
Automatic persisted queries - Apollo GraphQL Docs
Clients send queries to Apollo Server as HTTP requests that include the GraphQL string of the query to execute. Depending on your graph's...
Read more >
API Reference: ApolloServer - Apollo GraphQL Docs
A key-value cache that Apollo Server uses to store previously encountered GraphQL operations (as DocumentNode s). It does not store query results. Whenever ......
Read more >
GraphQL schema basics - Apollo GraphQL Docs
This schema defines a hierarchy of types with fields that are populated from your back-end data stores. The schema also specifies exactly which...
Read more >
Handling operation errors - Apollo GraphQL Docs
Apollo Client can encounter a variety of errors when executing operations on ... is not populated), and any returned data is cached and...
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