# TypeError: ResourceGetter is not a constructor

**URL:** <https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599>\
**Category:** Help me!\
**Created:** [January 11, 2021, 11:05am UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599 "2021-01-11T11:05:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cberez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/cberez/32/511_2.png) [@cberez](https://community.forestadmin.com/u/cberez)\
**Post date:** [January 11, 2021, 11:05am UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/1 "2021-01-11T11:05:41Z")

</div>

## Expected behavior

No error

## Actual behavior

We get a `TypeError: ResourceGetter is not a constructor` when using `ResourceGetter`:

```javascript
const { ResourceGetter } = require('forest-express-sequelize')

const resourceGetter = new ResourceGetter(models.orders, { recordId: orderId })
const order = await resourceGetter.perform()

```

However I see in the codebase that our syntax looks correct: [forest-express-sequelize/databases.test.js at 7cceb40153165b65089df011ed4acd02fbcdb97a · ForestAdmin/forest-express-sequelize · GitHub](https://github.com/ForestAdmin/forest-express-sequelize/blob/7cceb40153165b65089df011ed4acd02fbcdb97a/test/databases.test.js#L2167)

## Failure Logs

Nothing more than the TypeError

## Context

Please provide any relevant information about your setup.

- forest-express-sequelize: 6.6.3
- forest-express: 7.9.4
- Express Version: 4.17.1
- Sequelize Version: 5.19.6
- Database Dialect: Postgres
- Database Version: -
- Project Name: UrbanCampus - Platform
- Environment: all of them

It’s pretty urgent for us as we noticed the issue on prod and just upgraded from v5 to v6 so we’d like to avoid a rollback… Thanks

---

<div class="post-metadata">

**Author:** ![anon37102731](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon37102731](https://community.forestadmin.com/u/anon37102731)\
**Post date:** [January 11, 2021, 11:49am UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/2 "2021-01-11T11:49:40Z")

</div>

Hi @cberez,

Could you check that you required the `ResourceGetter` properly at the beginning of the file on which the error is happening?

```javascript
{ ResourceGetter } = require('forest-express-sequelize');

```

---

<div class="post-metadata">

**Author:** ![cberez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/cberez/32/511_2.png) [@cberez](https://community.forestadmin.com/u/cberez)\
**Post date:** [January 11, 2021, 4:02pm UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/3 "2021-01-11T16:02:19Z")

</div>

Hi @anon37102731,

Here’s the require line (updating the original message too):

```javascript
const { ResourceGetter } = require('forest-express-sequelize')

```

---

<div class="post-metadata">

**Author:** ![cberez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/cberez/32/511_2.png) [@cberez](https://community.forestadmin.com/u/cberez)\
**Post date:** [January 11, 2021, 4:04pm UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/4 "2021-01-11T16:04:44Z")

</div>

To be more precise: it’s an old code that’s been there for some time and used to work, now we get the `TypeError`, it seems since we upgraded to 6.6.3

---

<div class="post-metadata">

**Author:** ![anon37102731](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon37102731](https://community.forestadmin.com/u/anon37102731)\
**Post date:** [January 11, 2021, 4:36pm UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/5 "2021-01-11T16:36:25Z")

</div>

@cberez I just looked at the code and the `ResourceGetter` service is not exposed through `forest-express-sequelize`. It’s only intended to be used internally.

However, a `RecordGetter` is exposed to perform the kind of record retrieval logic you’re trying to build. You can find several example of this `RecordGetter` usage on our [documentation](https://docs.forestadmin.com/documentation/reference-guide/routes/default-routes#get-a-record).

I hope you’ll find what you need in there!

---

<div class="post-metadata">

**Author:** ![cberez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/cberez/32/511_2.png) [@cberez](https://community.forestadmin.com/u/cberez)\
**Post date:** [January 11, 2021, 4:37pm UTC](https://community.forestadmin.com/t/typeerror-resourcegetter-is-not-a-constructor/1599/6 "2021-01-11T16:37:36Z")

</div>

Ah must’ve been hidden on latest versions, our code dates back to v4

Thanks I’ll have a look to the `RecordGetter`
