Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Network error: window is not defined #3

Closed
michaelmerrill opened this issue Mar 31, 2017 · 3 comments
Closed

Error: Network error: window is not defined #3

michaelmerrill opened this issue Mar 31, 2017 · 3 comments
Labels

Comments

@michaelmerrill
Copy link

Hi Jay,

I'm pretty sure this is an error on my end, but if you have any advice I would love to hear it. I'm using next.js with apollo-client and getting 'window is not defined' when I switch to the new createNetworkInterface.

{ Error: Network error: window is not defined at new ApolloError (/Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/errors/ApolloError.js:32:28) at /Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/core/QueryManager.js:260:41 at /Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/core/QueryManager.js:683:25 at Array.forEach (native) at /Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/core/QueryManager.js:680:27 at Array.forEach (native) at QueryManager.broadcastQueries (/Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/core/QueryManager.js:677:42) at Array.<anonymous> (/Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/core/QueryManager.js:63:23) at dispatch (/Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/redux/lib/createStore.js:186:19) at /Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/ApolloClient.js:174:30 graphQLErrors: [], networkError: ReferenceError: window is not defined at HTTPUploadNetworkInterface.fetchFromRemoteEndpoint (/Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-upload-client/src/network-interface.js:6:26) at /Users/michaelmerrill/code/src/github.com/michaelmerrill/snapflix-client/node_modules/apollo-client/src/transport/networkInterface.js:108:71, message: 'Network error: window is not defined', extraInfo: undefined, queryErrors: [ [Circular] ] }

@jaydenseric jaydenseric added the bug label Apr 1, 2017
@jaydenseric
Copy link
Owner

Ahh! Great point, it's a bug, and should be easy to fix. I'll get onto it.

@jaydenseric
Copy link
Owner

Turns out this will be fixed when this issue is fixed for both the client and server projects.

Basically in the last major version before I added query batching support, apollo-upload-server and apollo-upload-client reverted to the standard transport system for requests that do not have uploads. I wanted to add those smarts back this weekend, but I ran out of time.

I created apollo-upload-examples for the duel purpose of helping people understand the setup, but also for us to have a somewhat realistic project to develop against. Until now I have been stashing my work on a real project and developing these packages against it, which has been a bit inconvenient. It's not linked in any readmes yet.

If you would like to help out, we need to add another multiple file upload example component and mutation. We should also replace the placeholder query with something better, and use it on the page so that we can see SSR works ok. Perhaps instead of just console logging uploads in the resolvers, we could add them to a dummy database, something JSON based? I feel like I have seen a dummy database in an example Apollo project somewhere before. The query could then display all the uploads on the page in a list component.

@jaydenseric
Copy link
Owner

jaydenseric commented Apr 5, 2017

@michaelmerrill Working ok, with the new version?

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

No branches or pull requests

2 participants