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.

How to implement next-with-apollo with react-apollo SSR?

See original GitHub issue

I am using react-apollo with Next.js the way it is illustrated in the example from the Next.js repo.

Complete question detail on Spectrum Next.js community.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
lfadescommented, May 22, 2019

@KumarAbhirup I don’t really know why but here are some solutions:

  • Make sure that the cookie is set with the proper domain, so the browser is not excluding it, for this case you can for example let the Next.js app set and handle the cookie, instead of your backend, you can see this file to get an idea of how it works.
  • Try not to send the headers and instead just send the cookie you need, use the same file from before to get the cookie from headers and then send the Authorization header, if you can’t get the cookie then it’s likely that either the browser is not sending it to you, or it’s not set, you can always use devTools in the browser to see the cookies.

Always remember that headers are only present in the first render of your site (in SSR), then headers will always be undefined and you should use either document.cookie or the credentials option for fetch operations.

I’m going to close this issue for now because it’s not related to this package, I hope you solve it 🙏

1reaction
kumarabhirupcommented, Apr 7, 2020

I am using @apollo/react-hooks. Just wondering, if next-with-apollo supports it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-side rendering - Apollo GraphQL Docs
Server-side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw HTML...
Read more >
How to implement next-with-apollo with react-apollo SSR?
I want to implement the headers argument from next-with-apollo package like this import withApollo from 'next-with-apollo' import ...
Read more >
Server-side rendering (SSR) using Apollo and Next.js - Medium
Apollo: Has that special method called getDataFromTree that finds in your page tree all components that use the hook useQuery. They then execute...
Read more >
Configure Apollo Client with Next.js - Hasura
React Apollo Hooks Installation ... Create Apollo Client Instance ... Create a file called apolloClient.js inside the lib folder and write the following ......
Read more >
next-with-apollo - npm
Start using next-with-apollo in your project by running `npm i ... Now your page can use anything from @apollo/react-hooks or react-apollo .
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