Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 651 Bytes

routes-must-be-array.mdx

File metadata and controls

39 lines (31 loc) · 651 Bytes
title
Custom Routes must return an array

Why This Error Occurred

When defining custom routes an array wasn't returned from either headers, rewrites, or redirects.

Possible Ways to Fix It

Make sure to return an array that contains the routes.

Before

module.exports = {
  async rewrites() {
    return {
      source: '/feedback',
      destination: '/feedback/general',
    }
  },
}

After

module.exports = {
  async rewrites() {
    return [
      {
        source: '/feedback',
        destination: '/feedback/general',
      },
    ]
  },
}