# Updating default routes

**URL:** https://community.forestadmin.com/t/updating-default-routes/3968
**Category:** Help me!
**Created:** [January 6, 2022, 9:38am UTC](https://community.forestadmin.com/t/updating-default-routes/3968 "2022-01-06T09:38:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![timothyarmes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/timothyarmes/32/3450_2.png) [@timothyarmes](https://community.forestadmin.com/u/timothyarmes)
#### Post date: [January 6, 2022, 9:38am UTC](https://community.forestadmin.com/t/updating-default-routes/3968/1 "2022-01-06T09:38:28Z")

</div>

Hi,

I’m trying to update a default update route in order to call my own server _after_ FA has handled the update

The original code looked like this:

```javascript
router.put('/users/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
  next();
});

```

[This page](https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/extend-a-route) “explains” how to add logic after the default behaviour:

> At some point, you may want to trigger your remote logic **after** Forest Admin’s logic.
> 
> To achieve this, you can manually recreate `next()` 's behavior by using the snippets of default routes, then append your own logic.

So, using the default snippet found [here](https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes), I now have this:

```javascript
// Update a User
router.put('/users/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
  const recordUpdater = new RecordUpdater(users);
  recordUpdater.deserialize(request.body)
    .then(recordToUpdate => recordUpdater.update(recordToUpdate, request.params.recordId))
    .then(record => { console.log(record); return record })
    .then(record => recordUpdater.serialize(record))
    .then(recordSerialized => response.send(recordSerialized))
    .catch(next);
});

```

I wanted to ensure that I still had the default behaviour, but now when I update a users I get this error at the point where the code tries to instantiate a new RecordUpdater:

> [forest] 🌳🌳🌳 Unexpected error: Cannot read property ‘timezone’ of undefined  
> {  
> “stack”: "TypeError: Cannot read property ‘timezone’ of undefined\n at new AbstractRecordService (/Users/Tim/Development/…/forest/node\_modules/forest-express/dist/services/exposed/abstract-records-service.js:20:17)\n

I’m using forest-express-sequelize v8.

Are the snippets on the documentation page out of date? How can I solve this?

Thanks,

Tim

---

<div class="post-metadata">

### Author: ![Arnaud\_Moncel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud_moncel/32/24_2.png) [@Arnaud\_Moncel](https://community.forestadmin.com/u/Arnaud_Moncel)
#### Post date: [January 6, 2022, 9:47am UTC](https://community.forestadmin.com/t/updating-default-routes/3968/2 "2022-01-06T09:47:04Z")

</div>

Hi @timothyarmes 👋 according to our documentation [Default routes - Documentation](https://docs.forestadmin.com/documentation/reference-guide/routes/default-routes#update-a-record)  
there is a little error in your code.

```javascript
const recordUpdater = new RecordUpdater(users);
// should be
const recordUpdater = new RecordUpdater(users, request.user, request.query);

```

Let me know if it fix your issue.

---

<div class="post-metadata">

### Author: ![timothyarmes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/timothyarmes/32/3450_2.png) [@timothyarmes](https://community.forestadmin.com/u/timothyarmes)
#### Post date: [January 6, 2022, 10:46am UTC](https://community.forestadmin.com/t/updating-default-routes/3968/3 "2022-01-06T10:46:29Z")

</div>

Hi,

Thank you, that does fix the issue!

It would be great if you could update the code on the documentation page to reflect this.

**EDIT** : I understand what happened, my Google search ended up on version 6 of the documentation.

Regards

Tim

---

<div class="post-metadata">

### Author: ![Arnaud\_Moncel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud_moncel/32/24_2.png) [@Arnaud\_Moncel](https://community.forestadmin.com/u/Arnaud_Moncel)
#### Post date: [January 6, 2022, 11:26am UTC](https://community.forestadmin.com/t/updating-default-routes/3968/4 "2022-01-06T11:26:30Z")

</div>

Happy to hear your issue is fixed.  
Can you give me the search you have execute in order to try to fix the redirection 🙏
