2020-02-24 23:01:02 +01:00
|
|
|
# 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
|
|
|
|
// next.config.js
|
|
|
|
module.exports = {
|
2020-06-27 11:18:18 +02:00
|
|
|
async rewrites() {
|
|
|
|
return {
|
|
|
|
source: '/feedback',
|
|
|
|
destination: '/feedback/general',
|
|
|
|
}
|
2020-02-24 23:01:02 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**After**
|
|
|
|
|
|
|
|
```js
|
|
|
|
module.exports = {
|
2020-06-27 11:18:18 +02:00
|
|
|
async rewrites() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: '/feedback',
|
|
|
|
destination: '/feedback/general',
|
|
|
|
},
|
|
|
|
]
|
2020-02-24 23:01:02 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|