kumarabhirup/paprink

Deployment issues

Closed this issue ยท 12 comments

So many problems while deploying.

Problem 1:
On production, we see this error ๐Ÿ‘‡

app[web.1]: [Network error]: ServerParseError: Unexpected token < in JSON at position 0

That error never appears on localhost. This might be because server is returning an HTML document.

Problem 2:
When it works on localhost, it is connected to a remote database, everything works very slow. Thus, a delay appears everywhere and also causes styling issues. Thus, a complete app frontend restructuring might be needed.

Problem 1 solved:
The env file wasn't working on production! So, changed the env vars of withData.js to hardcoded and it worked.
But, env file is used at various other places. It isn't yet confirmed if the env file works there or not.

To solve problem the efficient way, we need env to work properly.

PROBLEM 1 SOLVED!

To solve PROBLEM 2, a new branch is created.
https://github.com/KumarAbhirup/paprink/tree/noLagOnProdPlease!

To solve the lag issue, the data is now served on server and now there's no loading!
Except, few bugs such as User not visible after signin.

User isn't available after signIn because server fails to provide us the me payload.
After the new implementation for SSR, the server gives context.request.userId as null! This is a server problem. Needs a fix.

The bug occurs because the implementation of react-apollo SSR lacks the request function like we had in withData.js ๐Ÿ‘‡

request: operation => {
      operation.setContext({
        fetchOptions: {
          credentials: 'include',
        },
        headers
      })
    }

Question regarding the issue is posted on Spectrum and Stack Overflow.

Issue also opened on these 3 repos:
Next.js
react-apollo
next-with-apollo

This is the biggest hurdle. Launching isn't possible if the bug continues.

Commit c42743a fixes the Problem 2.
Special thanks to Harshit.

This issue got fixed after sweating for more than 20 days... Only I know, what it felt like ๐Ÿ˜…
I am celebrating that I am finally, finally... closing this issue.