MemberJunction / MJ

Main MemberJunction Repository
https://docs.memberjunction.org/
ISC License
4 stars 0 forks source link

Error uploading files #387

Closed cadam11 closed 2 months ago

cadam11 commented 3 months ago

Calling the CreateFile graphql mutation fails with this error

Error: Field _mj__CreatedAt does not exist on Files

Note that a database record does get created for the new file, but no preauth upload URL is returned.


Basically, as part of the file record creation, we first create a base record (originally to get its unique ID) then update that record immediately once we get the pre-auth upload url from the storage provider. To update that entity, we first create an empty entity record and load it with the input data from the mutation, then change just the fields that we need to (status, notably) and save the entity record before returning the whole mutation response payload.

The problem is that the input now includes a synthetic _mj_CreatedAt that doesn't actually match the entity's __mj_CreatedAt field.