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

How to debug on AWS? Error display 404, no logs #3988

Closed
1 task done
Vadorequest opened this issue Mar 11, 2018 · 4 comments
Closed
1 task done

How to debug on AWS? Error display 404, no logs #3988

Vadorequest opened this issue Mar 11, 2018 · 4 comments

Comments

@Vadorequest
Copy link
Contributor

Vadorequest commented Mar 11, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

I uploaded my Next.js/Express app on AWS and it's failing at runtime for unknown reason.

I have the following AWS logs:

START RequestId: 27f88393-2541-11e8-af21-a362290178d9 Version: $LATEST
2018-03-11 16:30:42.490 (+01:00)        27f88393-2541-11e8-af21-a362290178d9    req from http://staging.loan-advisor.studylink.fr/
END RequestId: 27f88393-2541-11e8-af21-a362290178d9
REPORT RequestId: 27f88393-2541-11e8-af21-a362290178d9  Duration: 600.55 ms     Billed Duration: 700 ms         Memory Size: 256 MB     Max Memory Used: 40 MB  

START RequestId: 293c9c47-2541-11e8-9e47-bb956db55617 Version: $LATEST
2018-03-11 16:30:43.008 (+01:00)        293c9c47-2541-11e8-9e47-bb956db55617    req from http://staging.loan-advisor.studylink.fr/_next/fa74e99a-3209-47d0-b35e-096852884958/page/_error.js
END RequestId: 293c9c47-2541-11e8-9e47-bb956db55617
REPORT RequestId: 293c9c47-2541-11e8-9e47-bb956db55617  Duration: 123.53 ms     Billed Duration: 200 ms         Memory Size: 256 MB     Max Memory Used: 40 MB  

What I could deduce from those logs is that a request is handled at http://staging.loan-advisor.studylink.fr/ by Express and then a new request from http://staging.loan-advisor.studylink.fr/_next/fa74e99a-3209-47d0-b35e-096852884958/page/_error.js is handled.

Next loads correctly IMHO, since it's able to load the http://staging.loan-advisor.studylink.fr/_next/fa74e99a-3209-47d0-b35e-096852884958/page/_error.js script, which, I guess, displays a 404?

So, something is wrong when Next.js app tries to display something initially, but I have nothing to help me debug the issue 😕

Locally, everything works correctly, but I'm concerned about the lack of logs in the AWS environment, which makes it super hard to debug anything.

I did force quiet: false when instanciating my Next.js app but it doesn't have any effect.


Edit: I made a simple debug page at https://staging.loan-advisor.studylink.fr/debug which works fine and gets rendered correctly, so my first assumption is right, an exception happens in the index page which leads to throwing a 404 somehow. (instead of a 500 :/)

@timneutkens
Copy link
Member

Upgrade to latest canary. Should be fixed there.

@Vadorequest
Copy link
Contributor Author

Vadorequest commented Mar 11, 2018

@timneutkens Okay, I'll try that.

Also, I just noticed I don't find any example of Page using class, is the following code valid?

class Index extends Component {

  static async getInitialProps({req}) {
    const groupName = resolveCurrentGroupName(req.headers.host);
    console.log('groupName resolved: ', groupName);
    const settings = await getSettings();
    const group = await getGroup(groupName, settings);

    return {settings, group};
  }

  render() {
    const {settings, group} = this.props;

    return (
      <LoanAdvisor
        settings={settings}
        group={group}
      >
        <IndexPage />
      </LoanAdvisor>
    );
  }
}

export default Index;

Edit: Actually I just found this example which does use class, so it seems valid to me.

https://github.com/zeit/next.js/blob/9320d9f006164f2e997982ce76e80122049ccb3c/examples/with-antd-mobile/pages/index.js

@Vadorequest
Copy link
Contributor Author

@timneutkens Indeed, updating from canary 09 to 14 worked. I still have errors but they are visible on the AWS logs now. Thanks!

@timneutkens
Copy link
Member

👍 there was a bug which I fixed in 14 👍

@lock lock bot locked as resolved and limited conversation to collaborators May 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants