Gatsby 404 Page

Hey,

my Gatsby App has configured a standard 404 page, but when it’s deployed to Layer0, not registered route get AWS error:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>YTENEMVM09GYDJZ4</RequestId>
<HostId>iyY//fFYxmio77G0LI7HA3fIbu4wbAKo4yhBg1sxeiYZBfBkWNQyX02jkYmLNpqfo3aUN71rYEQ=</HostId>
</Error>

Could you guide me on how do I catch the 404 and send it to the App?

There’s no prefetching configured and router is as simple as:

const { Router } = require('@layer0/core/router');
const { gatsbyRoutes } = require('@layer0/gatsby');

module.exports = new Router().use(gatsbyRoutes);

Have you created a src/pages/404.js as mentioned in their guide? During build, that get compiled to a static 404.html which is served. If the file doesn’t exist, that error will be returned since the resource doesn’t exist on AWS.

I did follow that guide to add the page to our example app and I do get the expected result: https://tristan-lee-hr-layer0-gatsby-example-default.layer0-limelight.link/404

Yes, I did create that view but the result is the same as yours.

/404 works, because that’s the exact file, but when you go to https://tristan-lee-hr-layer0-gatsby-example-default.layer0-limelight.link/45f745 it doesn’t work with the very same error.

Hey @Kubitomakita,

Can you run the following and let me know if it works fine:

# Upgrade to the latest Edgio CLI v5
# per the docs
https://docs.edg.io/guides/v5_migration

# Integrate the Edgio's Gatsby Connector
edgio init && edgio deploy