V8-archive: Cannot add files or m2m field

Created on 28 Mar 2019  Â·  10Comments  Â·  Source: directus/v8-archive

Bug Report

Sometimes i am not able to add a relations field (in my case the files and the many to many interface). I get this js error : vue.runtime.esm.js:1888 TypeError: Cannot read property 'fields' of undefined which is caused by the file:
getters.js (webpack:///./src/store/modules/relations/getters.js)
at this line:
field_many: collections[result.collection_many].fields[result.field_many],

Steps to Reproduce

Only on certain collections, i don't know what is the cause since the relational interfaces seems to work on every other collections. I just added and removed some relational fields.

Expected Behavior

To work as expected

Actual Behavior

I am not able to add some interfaces due to a js errors.

Other Context & Screenshots

https://www.dropbox.com/s/b7g0e2c91xfkpo2/Annotazione%202019-03-28%20174133.jpg?dl=0

Technical Details

  • Device: Intel Nuc
  • OS: Windows 10
  • Web Server: Apache
  • PHP Version: 7.2
  • Database: MySql 5.7
  • Install Method: cloned
bug

Most helpful comment

It seems that if you remove m2m relation, the metadata about it doesn't get completely cleaned from the database. I managed to make it work with a following workaround: go to the database -> directus_relation table and find the 2 existing records about the m2m relation you previously removed and delete those records. Refresh the app and it should work again.

So the bug is: Removing m2m relation on collection doesn't clean up all the metadata from the database (directus_relation table)

All 10 comments

Same error here after added a m2m relation and deleted it.
Any workaround while waiting for a fix ?

@bjgajjar @hemratna — any thoughts on this?

@benhaynes

I will look into it and let you know soon.

@luglio7 @wiwski There is a known issue of relational fields that they are not being synced with VueX once updated, hence Vue does not know how to handle those. Can you refresh the app after changes are made in relational fields and try again and let me know if the error occurs?

Already tried, does not work.
Sadly i removed the project.

It seems that if you remove m2m relation, the metadata about it doesn't get completely cleaned from the database. I managed to make it work with a following workaround: go to the database -> directus_relation table and find the 2 existing records about the m2m relation you previously removed and delete those records. Refresh the app and it should work again.

So the bug is: Removing m2m relation on collection doesn't clean up all the metadata from the database (directus_relation table)

Fixed in #1009

Great! I had this same problem just now.

Hey @lcdss

Can you please elaborate on your problem? Cause after the #1009; I don't think so the issue will still persist. So It will be great if you can explain your issue.

same issue, i deleted the m2m field in a collection, with the last version of directus 7, and then i was not able to add any new m2m field to the same collection again.
I tried also to erase and recreate the collection but with no luck.

to notice: If i try to add the field to a brand new collection then i can add an m2m field with no problem at all

need some help no doubt...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nitwel picture Nitwel  Â·  3Comments

vuhrmeister picture vuhrmeister  Â·  3Comments

HashemKhalifa picture HashemKhalifa  Â·  3Comments

rijkvanzanten picture rijkvanzanten  Â·  3Comments

cdwmhcc picture cdwmhcc  Â·  3Comments