rsnext/errors/routes-must-be-array.mdx
Delba de Oliveira 44d1a1cb15
docs: Migrate error messages to MDX and App Router. (#52038)
This PR is part of a larger effort to migrate error messages to MDX and
use App Router: https://github.com/vercel/front/pull/23459
2023-07-05 06:11:16 -07:00

39 lines
651 B
Text

---
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**
```js filename="next.config.js"
module.exports = {
async rewrites() {
return {
source: '/feedback',
destination: '/feedback/general',
}
},
}
```
**After**
```js filename="next.config.js"
module.exports = {
async rewrites() {
return [
{
source: '/feedback',
destination: '/feedback/general',
},
]
},
}
```