# Can't create new resources

**URL:** https://community.forestadmin.com/t/cant-create-new-resources/2270
**Category:** Help me!
**Created:** [April 8, 2021, 11:01am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270 "2021-04-08T11:01:27Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:01am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/1 "2021-04-08T11:01:27Z")

</div>

## Expected behavior

Should be able to create a new resource with given permissions

## Actual behavior

After filling the form for creating a new resource I get the error: collection can’t be found and this is thrown in the console:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/5/518ca4efb2beb87684f7382e6aa6be7f5da66a11.png)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/ccb87988383c49f33df994b3d8de92474723f3ea.png)  
I’m not sure if this is related, but we noticed this happening after upgrading Forest Admin to the new roles system. We can’t create any resources now.  
I have no idea what this error is about and it doesn’t give us a clue that is something in the routes or so.  
I’d appreciate some help here asap. Thanks!

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 11:32am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/2 "2021-04-08T11:32:18Z")

</div>

Hello @nathanqueija,

Could you please check that the role assigned to user user trying to create a record has correct create permission?

Also a screencast of the creation and submitting the form would help. You can do it with [loom](https://www.loom.com) for example

Thank you

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:35am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/3 "2021-04-08T11:35:24Z")

</div>

Yes, it does have the correct permission. I see the record created on the database so the route is definitely being processed correctly. It looks like it’s an issue on the frontend processing the response.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 11:39am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/4 "2021-04-08T11:39:33Z")

</div>

Okay, so your record is created, and the error happens after you saw the green toastr about successfully created record?

If you try to access this record from the record list, are you able to open it without any issue?

Could you please check the Network tab of your developer console to see if there are any failed requests?

Thank you

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 11:41am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/5 "2021-04-08T11:41:20Z")

</div>

One more thing, you development environment is not impacted by the roles. Could you please try the creation in development environment so we can check if it roles related issue or not? Thanks

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:43am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/6 "2021-04-08T11:43:59Z")

</div>

Exactly. I get the green toastr saying that the record has created successfully, but then I get this screen:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/c47171116902d0c10c137bcbd4c1ebd1408a31c1.png)

The only request failing is this one: [https://api.forestadmin.com/api/activity-logs-requests](https://api.forestadmin.com/api/activity-logs-requests)

```javascript
curl 'https://api.forestadmin.com/api/activity-logs-requests' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Forest-Project-Id: 41863' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'Authorization: Bearer 'token secret here' \
  -H 'Forest-Rendering-Id: 86429' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Accept: vnd.forestadmin-api+json; version=2.8.1' \
  -H 'Forest-Environment-Id: 70866' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \
  -H 'Forest-Collection-Id: templates' \
  -H 'Forest-Team-Id: 56458' \
  -H 'sec-ch-ua: "Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"' \
  -H 'Origin: http://app.forestadmin.com' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: http://app.forestadmin.com/' \
  -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
  --data-raw '{"data":{"id":"2","attributes":{"type":"write","action":"create","label":"created","records":[null],"timing_interface":null,"timing_request":null},"relationships":{"rendering":{"data":{"type":"renderings","id":"86429"}},"collection":{"data":{"type":"collections","id":"templates"}}},"type":"activity-logs-requests"}}' \
  --compressed

```

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:45am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/7 "2021-04-08T11:45:03Z")

</div>

I’m also able to open the newly created resource if I manually go back to the table view.

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:49am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/8 "2021-04-08T11:49:26Z")

</div>

The same issue happens in all envs. And after I upgraded to the new roles system now I have two Dev environments. They are duplicated in the UI, but there is only one dev environment created in the settings area.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 11:55am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/9 "2021-04-08T11:55:41Z")

</div>

If the issue happens in the development environment, I don’t think it’s related to roles.

Do you have any custom logic in the creation route?

> [@nathanqueija](#):
>
> I’m also able to open the newly created resource if I manually go back to the table view.

Do you have all the data and references saved correctly?

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 11:59am UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/10 "2021-04-08T11:59:21Z")

</div>

I don’t know if it’s related to roles. I noticed that this started to happen after we migrated to the new roles system. Maybe it’s not related, but that’s not the core of the issue I think.  
In the creation route, we call an API, it’s a smart collection. It was working before and we didn’t change anything in the creation route.

What do you mean by: “Do you have all the data and references saved correctly?”  
I don’t understand what you mean by data and references.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 12:02pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/11 "2021-04-08T12:02:54Z")

</div>

Would you mind sharing with me the definition of your create route, so I can try to reproduce the issue? You can send it to me in a private message.

When I ask if you have all the data and references I mean that you have all the inputted data saved correctly and if you have some references to other collections in this data they are correctly saved and shown as well;. When you reopen the record after manually going back to the table view.

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 12:04pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/12 "2021-04-08T12:04:47Z")

</div>

Ah I see. Thanks for the clarification. We don’t have any references for this model. The data is saved correctly. I’ll send you the code for the create route via private message.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 12:55pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/13 "2021-04-08T12:55:26Z")

</div>

Thank you, I will do some tests on my end and let you know if I can find the issue.

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 1:01pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/14 "2021-04-08T13:01:46Z")

</div>

Ah, one thing that I forgot: even though the resource was created in the database there is no activity log on Forest Admin for this action. Sometimes, the API call for the activity logs is failing with 500 randomly: [https://api.forestadmin.com/api/rendering/86432/activity-logs?page[number]=1](https://api.forestadmin.com/api/rendering/86432/activity-logs?page%5Bnumber%5D=1)

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 1:20pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/15 "2021-04-08T13:20:24Z")

</div>

So there is not activity log for any of the failing resource creations or just for some? Does this error occurs randomly or systematically after the creation bug?

Also, you mentioned that this error happens for the smart collection, are you able to create records for other collections without issues or is the problem global?

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 1:22pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/16 "2021-04-08T13:22:56Z")

</div>

There is no activity record after the creation bug, but after this error happened I can’t see any activity logs in the Activity tab anymore. The API call always returns 500.  
This is the only collection we have creation action, all the other collections in our app are read-only. This is the first one we’re trying to implement the creation capability.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 1:29pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/17 "2021-04-08T13:29:49Z")

</div>

> [@nathanqueija](#):
>
> And after I upgraded to the new roles system now I have two Dev environments. They are duplicated in the UI, but there is only one dev environment created in the settings area.

You have this `Dev` environment, is it supposed to be a development or remote environment? This duplication issue can be caused by wrong environment type detection.

As for record creation, I am still working on reproducing the error

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 1:31pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/18 "2021-04-08T13:31:40Z")

</div>

The dev environment is a remote environment. I have another environment for local development.

---

<div class="post-metadata">

### Author: ![anon90145840](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon90145840](https://community.forestadmin.com/u/anon90145840)
#### Post date: [April 8, 2021, 1:36pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/19 "2021-04-08T13:36:55Z")

</div>

Would it be an issue for you to rename it to something not containing `Dev` in the name? For example `Staging`? It might solve the duplication issue

---

<div class="post-metadata">

### Author: ![nathanqueija](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nathanqueija/32/1837_2.png) [@nathanqueija](https://community.forestadmin.com/u/nathanqueija)
#### Post date: [April 8, 2021, 1:39pm UTC](https://community.forestadmin.com/t/cant-create-new-resources/2270/20 "2021-04-08T13:39:02Z")

</div>

I renamed it to Development, now I have two environments named Development 😅  
It was called only Dev before.

[Next page](https://community.forestadmin.com/t/cant-create-new-resources/2270.md?page=2)
