V8-archive: [Broken] Saving Files

Created on 12 Jun 2019  ·  15Comments  ·  Source: directus/v8-archive

On the latest suite & the demo the files and file interfaces are not saving the relation to directus_files.id

Using the files interface will insert NULL into the mapping table where the file ID should be, and the file interface will throw 'internal server error'.

I'm unsure if this is app or api, I think it's the app providing the API with an object which fails, where it should only be and ID passed through.

https://www.loom.com/share/47487a7fcb084f2ca7f813ef6d4d1838

Most helpful comment

@rijkvanzanten @shealavington Agree! It is the issue of API. I'll resolve it and send the PR ASAP.

All 15 comments

@rijkvanzanten @bjgajjar — App or API?

I don't think anything changed in the single file interface in this release 🤔 @bjgajjar any changes in the API that could've caused this?

From my _quick_ debugging before making this issue

The app is trying to send the entire item object {image:{id:13,title:'thing',type:'image/jpg'}}
However when looking at how the M2O works, the M2O only sends the ID. {image:13}

Following the above and making a post request using {image:13} will work without issue, however, sending the object ends up with internal server error, so I would believe it's app-based.

Perhaps it's failing to select the ID properly, therefore trying to submit the entire object instead of only the Primary-Key's value. I did at one point see an error in the console for can't select ID of null in a related collection.

I don't know if that helps :man_shrugging:

from a quick overflew about this issue it sounds a bit like:

  • a field validation could be misconfigured, which returns wrong parsing (api)
  • the schema type (field type in app) of the field is changed somewhere wrongly (if so probably it is somewhere in app)

... also not sure if it can help ;) ... reminds me a bit an errors i got while dealing with different field types and schemas

No defaults have been changed, also, there's nothing to change that could cause it to break, as Field Type can only be File and the MySQL Datatype can only be int. _(EG: 'image' can only be '13')_

Thanks for the insight though, I did have a look to be sure :)

@shealavington you're right, but it has historically always done that, so I'm wondering if something under the hood changed in the API that's now causing issues 🤷‍♂

Perhaps you're right with it being an API change as I did try older app versions, which didn't fix it.

Though I found that slightly odd, as the relational interfaces only send an ID whereas the file/files interfaces are sending the entire object which seems inconsistent haha. :joy:

@rijkvanzanten @shealavington Agree! It is the issue of API. I'll resolve it and send the PR ASAP.

@bjgajjar Awesome! Thanks for that, there's some good information in the two referenced issues above. :smile:

Sorry, but still have error, now i am unable to create a file field, in the most case i got an error about invalid format (also when saving uploaded files)

Have you test it?

i am on the latest master versions (api/app), and run the update script.
Could you please confirm, that creating a new file Filed and adding a file is working..

image

upps, somehow on the server is working, it might be related to the local env i have

I still have this issue, even after upgrading.

There have been no releases to the suite since this fix was implemented. I'm afraid you'll have to wait for the next release which could happen anytime between now and next week.

When will this be released? Can't save any files in my relations....

This was released three days ago.

https://github.com/directus/directus/releases

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HashemKhalifa picture HashemKhalifa  ·  3Comments

ondronix picture ondronix  ·  3Comments

cdwmhcc picture cdwmhcc  ·  3Comments

metalmarco picture metalmarco  ·  3Comments

jwkellyiii picture jwkellyiii  ·  3Comments