Manually force a 404

We have a route that makes a request to the api, if successful, is redirected, but if not and the api returns with a 500 internal server error, we would like to force a redirect to our 404 pg.

I’ve tried adding this to the catch block:

catch (e) {


  await renderNextPage('/404', res);


and it worked as expected locally, but when pushed to our default env. I got a 500 status with error: An unexpected error occurred while processing the request with next.js. (page="/404")

Any ideas on other ways to do this?

For Next, we have a method publicly documented as of v2.42.1 to render the Next 404 page.

  import { nextRoutes } from '@xdn/next'
  import { Router } from '@xdn/core/router'

  export default new Router()
    .get('/some/missing/page', (res) => {