Observable.js:6 Uncaught TypeError: Object prototype may only be an Object or null: undefined
See original GitHub issueI’ve updated my project to the latest apollo-client version as per the upgrade instructions.
"apollo-cache-inmemory": "^1.0.0",
"apollo-client": "^2.0.1",
"apollo-link": "^1.0.0",
"apollo-link-http": "^1.0.0",
"graphql": "^0.11.7",
"react-apollo": "^2.0.0",
And upgraded like so
const {InMemoryCache} = require('apollo-cache-inmemory');
const ApolloClient = require('apollo-client');
const createCustomLink = require('./createCustomLink');
const client = new ApolloClient({
link: createCustomLink({ // my custom Link implementation, not relevant to issue
schema,
context
}),
cache: new InMemoryCache().restore(initialApolloState)
});
However in my setup this code is blowing up client side on the apollo-client
import line (oddly enough it seems to work server side) with the exception
VM10091 bundle.js:42603 Uncaught TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (<anonymous>)
at webpackJsonp../node_modules/apollo-client/index.js.Observable___extends (VM10091 bundle.js:42603)
at VM10091 bundle.js:42611
at Object../node_modules/apollo-client/index.js (VM10091 bundle.js:42619)
at __webpack_require__ (VM10085 common.js:704)
at fn (VM10085 common.js:117)
at Object../src/universal/index.js (VM10091 bundle.js:118389)
at __webpack_require__ (VM10085 common.js:704)
at fn (VM10085 common.js:117)
at Object.1 (VM10091 bundle.js:119067)
I dug into the apollo-client code in my node_modules and it looks like it’s blowing up because the LinkObservable
import is not working (it’s undefined).
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { Observable as LinkObservable } from 'apollo-link';
import $$observable from 'symbol-observable';
var Observable = (function (_super) {
__extends(Observable, _super);
function Observable() {
return _super !== null && _super.apply(this, arguments) || this;
}
Observable.prototype[$$observable] = function () {
return this;
};
return Observable;
}(LinkObservable));
export { Observable };
//# sourceMappingURL=Observable.js.map
I’m stumped at what’s broken. My best guess is that possibly something is wrong with how webpack is pulling in the apollo-client modules.
Version
- apollo-client@2.0.1
- webpack@3.4.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
TypeError: Object prototype may only be an Object or null ...
I can't figure out which one was the problem or why the code that the error points to give wrong as it is...
Read more >TypeError: Object prototype may only be an ... - Forum - bpmn.io
I created new reactJs project to apply BPMN. ... TypeError: Object prototype may only be an Object or null: undefined.
Read more >Version 20.3.48+ give "TypeError: Object prototype may only ...
Forum Thread - Version 20.3.48+ give "TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf (<anonymous>)" ...
Read more >The "Uncaught TypeError: Object prototype may only be an ...
The "Uncaught TypeError: Object prototype may only be an Object or null: undefined" error occurs while inserting DevExpress Reporting widgets to ...
Read more >angular/angular - Gitter
how can you get an observable to return an object that is not an httpclient ... Object prototype may only be an Object...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@djyde I had the same issue with webpack 4.17. Upgrade to the fix 4.17.1 release two hours ago fix my issue.
Also, it is only happened when my Webpack mode is
prod