Gatsby 404 Page


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

<Message>Access Denied</Message>

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:

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 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

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