Hello,
I'm trying to implement a M2M Interface for multiple files import. However when trying to save multiple files (or just one) in the table i get the error:
Call to a member function getType() on null
in file www/directus/src/core/Directus/Application/CoreServicesProvider.php
on line 562
This is how my tables are set up:
blog (main table)
- id
- title
- content
- gallery (M2M interface)
images (the table where the images are saved)
- id
- image (File field)
blog_images (junction table)
- id
- blog_id
- images_id
And this is the configuration for the blog table:


And this is how my M2M table looks like with 3 pictures uploaded:

When I try to confirm the new entry I get the error I mentioned above.
Am I missing something or have I found a bug?
System info:
Ubuntu 18
Nginx 1.14.0
PHP 7.2
MySQL 5.7.24
Directus 7.0.4
Hey @arc4nis8, It seems you may configured something incorrectly, I couldn't reproduce this issue neither with the stable nor the development version.
Could provide the database dump you are using that triggers this error?, I created the schema based on your description and everything works as expected.
I will share the database dump I used, so you can try the same schema and see if it stills happens in your end.
The credentials are:
[email protected]passwordHello, I've tried your database dump and it works on my end. The error must have come from me trying to get the M2M interface to work and editing the tables lots of times. Now that I have created all the tables from scratch everything works fine. Sorry but I can't reproduce it anymore. Thanks for your time.
Fair enough! We appreciate you reporting this... let us know if it pops up again. You should be able to adjust things as often as you'd like without them breaking... of course that makes reproducing the issue more difficult.
Either way, thanks for following up!
Found where it is originated! on the table directus_relations sometimes an almost always there is some deleted relations after they have been deleted. And when you create a field for a different relation with the same name of another relation of something you already done and delete on that collection, then it throws the error because there are two relations with the same name.
Manually deleting the old relation entry fixed the issue.