# TypeError : Cannot read properties of undefined (reading 'map') on deployment

**URL:** https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994
**Category:** Help me!
**Created:** [February 14, 2023, 5:58pm UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994 "2023-02-14T17:58:48Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)
#### Post date: [February 14, 2023, 5:58pm UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/1 "2023-02-14T17:58:48Z")

</div>

Hello, there, i’m trying to deploy my app on my server but i get this error, triggering right after the server starts :

```javascript
remote: info: Successfully mounted on Standalone server (http://0.0.0.0:3000)
remote: [Server On]
remote: /usr/src/app/node_modules/@forestadmin/forestadmin-client/dist/schema/index.js:22
remote: const data = schema.collections.map(c => ({ id: c.name, ...c }));
remote: ^
remote: TypeError: Cannot read properties of undefined (reading 'map')
remote: at SchemaService.serialize (/usr/src/app/node_modules/@forestadmin/forestadmin-client/dist/schema/index.js:22:41)
remote: at SchemaService.postSchema (/usr/src/app/node_modules/@forestadmin/forestadmin-client/dist/schema/index.js:14:38)
remote: at ForestAdminClientWithCache.postSchema (/usr/src/app/node_modules/@forestadmin/forestadmin-client/dist/forest-admin-client-with-cache.js:25:35)
remote: at Agent.sendSchema (/usr/src/app/node_modules/@forestadmin/agent/dist/agent.js:152:62)
remote: at async Promise.all (index 1)
remote: at async Agent.start (/usr/src/app/node_modules/@forestadmin/agent/dist/agent.js:57:26)
remote: Node.js v18.14.0

```

I don’t have any problem in my local environment…

I’m using forest agent 1.6.1 and the mongoose datasource v1.2.4

Any hint about where my problem could be ?

---

<div class="post-metadata">

### Author: ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)
#### Post date: [February 14, 2023, 6:13pm UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/2 "2023-02-14T18:13:58Z")

</div>

Most probable cause sounds like a mismatch between versions of different @forestadmin packages.

Specifically, between the @forestadmin/agent and @forestadmin/forestadmin-client package.

Can you upgrade _all_ `@forestadmin` packages that are installed on your project to the latest version and try again?

Also, if your project explicitly depends on @forestadmin/forestadmin-client, it’s more than likely that you can drop that dependency, as it is internal

---

<div class="post-metadata">

### Author: ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)
#### Post date: [February 15, 2023, 9:23am UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/3 "2023-02-15T09:23:22Z")

</div>

Thanks for reply !  
Sounds weird to me as i don’t got the package @forestadmin/forestadmin-client.  
Maybe i missed something during installation ?  
Or is this what you said : i do not need the package explicitly to run forest ?  
Here’s my old package.json dependancies :

```javascript
  "dependencies": {
    "@forestadmin/agent": "^1.6.1",
    "@forestadmin/datasource-mongoose": "^1.2.4",
    "chalk": "^5.2.0",
    "cloudinary": "^1.33.0",
    "cors": "^2.8.5",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "mongoose": "^6.8.3",
    "morgan": "^1.10.0",
    "sharp": "^0.31.3"
  }

```

I updated to “@forestadmin/agent”: “^1.8.2”, “@forestadmin/datasource-mongoose”: “^1.3.1” but i still get the error.  
Tried to install the package explicitly and still got the same error.

I ran 2 deploys with theses versions :

```javascript
"dependencies": {
    "@forestadmin/agent": "^1.8.2",
    "@forestadmin/datasource-mongoose": "^1.3.1",
    [...others dependancies...]
  }

```

```javascript
"dependencies": {
    "@forestadmin/agent": "^1.8.2",
    "@forestadmin/datasource-mongoose": "^1.3.1",
    "@forestadmin/forestadmin-client": "^1.1.9",
    [...others dependancies...]
  }

```

Error message is weird tho, how could map() be undefined in node 18+ ?  
To give more intels : I’m trying to deploy on an Ubuntu server, into Docker container managed by Dokku and i use pnpm localy to develop.

Here’s my Dockerfile :

```javascript
FROM node:18-alpine
WORKDIR /usr/src/app
COPY . .
RUN npm install -s
CMD ["npm", "start"]

```

---

<div class="post-metadata">

### Author: ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)
#### Post date: [February 16, 2023, 12:22pm UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/4 "2023-02-16T12:22:52Z")

</div>

Watching the source code of forest admin client, i cannot find out why this error message is showing as the native Array.map() is not replaced in the project…

I’m a bit confused about how i get it to work and i did not encouter this problem whith the old version of Forest Admin, deployed on the exact same environment (created 1 year ago).

Could networking of my container be a problem here ? As it crashed on the sending of the schemas…

---

<div class="post-metadata">

### Author: ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)
#### Post date: [February 17, 2023, 9:39am UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/5 "2023-02-17T09:39:55Z")

</div>

I’ll try to reproduce this.  
I’ll come back to you in a minute

---

<div class="post-metadata">

### Author: ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)
#### Post date: [February 17, 2023, 9:59am UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/6 "2023-02-17T09:59:18Z")

</div>

Just tested with the versions that you provided, and everything seems to work on my end.

Can you:

- drop node\_modules / package-lock.json / yarn.lock and try reinstalling
- provide me with the output of `npm ls --depth 2`

---

<div class="post-metadata">

### Author: ![bilboramix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/bilboramix/32/3837_2.png) [@bilboramix](https://community.forestadmin.com/u/bilboramix)
#### Post date: [February 17, 2023, 11:24am UTC](https://community.forestadmin.com/t/typeerror-cannot-read-properties-of-undefined-reading-map-on-deployment/5994/7 "2023-02-17T11:24:12Z")

</div>

Okay it’s working now but it’s not expected… I mean i destroyed my container (Because i couldn’t push anymore with failing build).

Then based on what you said i added my lockfile (pnpm-lock.yaml) into .gitignore, delete node\_modules and the lockfile, commit and tried to repush then it works.

Well, thank you !

(Pretty sure it was because i use pnpm in local and npm on the distant machine)
