Skip to content

URQL SSR With Next.js #1004

Answered by HarryET
HarryET asked this question in Q&A
Sep 27, 2020 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

Here is the fix:

export const createUrqlClient = (ssrExchange: SSRExchange, ctx?: NextPageContext): any => ({
    url: "http://localhost:80/graphql",
    fetchOptions: {
        credentials: "include" as const,
        headers: {
            cookie: ctx?.req?.headers?.cookie
        }
    },
    exchanges: [
        devtoolsExchange,//! REMOVE IN PROD
        dedupExchange,
        cacheExchange({
            // ... removed for ease of reading :)
        }),
        ssrExchange,
        fetchExchange
    ]
})

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@HarryET
Comment options

@HarryET
Comment options

@JoviDeCroock
Comment options

@kitten
Comment options

@HarryET
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by HarryET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants