Next.js: Custom Error Page Not Working

Created on 5 Jun 2019  路  6Comments  路  Source: vercel/next.js

Bug report

Describe the bug

I've been following the instructions here for some time: https://nextjs.org/docs#custom-error-handling

But it doesn't seem that whether I deploy a site using @now/static-build or using @now/next, whenever I get a 404 on my site, the site gets redirected to the default now 404 page, not my custom page.

To Reproduce

I have a small example of a website that utilizes next and bulma and node-sass and @zeit/next-sass. Here's the source code:

https://github.com/jvarness/next-with-bulma

For convenience, I have deployed this public project to zeit using both the next builder and the static-build builder.

https://next-with-bulma-72ahovqkn.now.sh/ <- next lambdas
https://next-with-bulma-1lj0u8d2k.now.sh/ <- static

Might this have something to do with how next-sass alters the webpack config? I don't think so but I'm unsure.

Expected behavior

When I go to the fake page on both, I should get the custom 404 page, but I just get the zeit one:

https://next-with-bulma-72ahovqkn.now.sh/fake
https://next-with-bulma-1lj0u8d2k.now.sh/fake

Screenshots

I don't have any screenshots for this.

System information

  • OS: Windows
  • Browser (if applies) Chrome
  • Version of Next.js: 8.1.0

Additional context

You guys are awesome and your products are fantastic!

Most helpful comment

@Timer still doesn't appear to be working for static. New URLs:

https://next-with-bulma-j9nerbg2e.now.sh/woop <- Lambdas
https://next-with-bulma-7pamzks1f.now.sh/woop <- Static

All 6 comments

Please let me know if there is any other information I can provide.

Hello! We've fixed this in the latest @now/next builder canary.

You can try it by updating your now.json to use @now/next@canary.

@Timer thanks for responding!

Will the static version of the page also work on the canary version of the static builder? Or is the intent to create some sort of custom node server that automatically redirects 404's to the error page?

Hmm, both versions should work. Let us know if it doesn't!

This change has been released to the stable builder.

@Timer still doesn't appear to be working for static. New URLs:

https://next-with-bulma-j9nerbg2e.now.sh/woop <- Lambdas
https://next-with-bulma-7pamzks1f.now.sh/woop <- Static

Was this page helpful?
0 / 5 - 0 ratings

Related issues

swrdfish picture swrdfish  路  3Comments

formula349 picture formula349  路  3Comments

rauchg picture rauchg  路  3Comments

lixiaoyan picture lixiaoyan  路  3Comments

kenji4569 picture kenji4569  路  3Comments