You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Graphql returning null for fields of type upload #6221
All of a sudden graphql has stopped returning any data for all media relation fields of type upload. If the field is not required I'm getting just null, and when it's I'm getting error: cannot return null for non-nullable field.
The REST API is working as expected. The graphql just stopped working at some point.
Here is my default media collection with right read access:
The thing is it just stopped working. Only thing I can think of would be that I've prepared demo about Payload at work, so I created other Payload project in the same parent directory, but it seems so impossible that I almost feel ashamed thinking about this.
Update: I've just uploaded the reproduction repo. In order to reproduce it you need to enter admin panel, create example Page, then go to localhost:3000/api/graphql-playground and execute the following query. You will see null instead of image id in the gql response.
queryTest {
Pages {
docs {
image {
id
}
}
}
}
Payload Version
2.0.0
Adapters and Plugins
No response
Reacted by Adrian Włoszyński, Dmitry M. Gavrovsky, Marcin Oracz, An Nguyen, Jonathan Wu, Jens Becker, Petro Konokhov, Jarrod Flesch, wkd and Andrew Kalita
I was experiencing the same issue and was able to work around it for now.
I believe this issue is caused by the 2.15.0 release. After reverting back to 2.14.0 my upload fields don't return null anymore.
Likely you didn't update any packages on your side manually, but as this is a minor patch you'll want to remove the caret in your package version e.g. ^2.0.0 can be 2.0.0
Reacted by Dmitry M. Gavrovsky, Jens Becker and Bartosz Karpiel
Hey everyone, thanks for the report. The fix will go out after this PR is merged into main and main is released (shooting for today). Will also make PR for beta branch too.
@JarrodMFlesch I'm still having this issue on 2.16.1.
In my case, the issue is even stranger because the upload field doesn't return null for every GraphQL request.
When I spam the server with requests in Altair and I can see null being returned for like 1/10 requests. Can this be an unresolved promise or something?
Reacted by Nico Hülscher, Smirnova, Bartosz Karpiel and wkd
Activity
flamedmg commentedon May 5, 2024
i have the same issue, it was working just fine on firay, but on saturday it stopped to work. No changes were made.
slavanossar commentedon May 6, 2024
Also experiencing this issue, works in
2.14.2but breaks after upgrading to2.15.0.Possibly related to #6141.
jonowu commentedon May 6, 2024
I was experiencing the same issue and was able to work around it for now.
I believe this issue is caused by the
2.15.0release. After reverting back to2.14.0my upload fields don't returnnullanymore.Likely you didn't update any packages on your side manually, but as this is a minor patch you'll want to remove the caret in your package version e.g.
^2.0.0can be2.0.0sburgpit commentedon May 6, 2024
Also experiencing same issue, when upgrading from
2.14.2to2.15.0slongiaru-dmind commentedon May 6, 2024
Here too update from 2.12.1 to 2.15.0.
Via the REST API it seems to work fine.
JarrodMFlesch commentedon May 6, 2024
Hey everyone, thanks for the report. The fix will go out after this PR is merged into main and main is released (shooting for today). Will also make PR for beta branch too.
JarrodMFlesch commentedon May 6, 2024
Fix was released in 2.16.0.
pzpsofficial commentedon May 6, 2024
@JarrodMFlesch Thanks for that fix and for all great work 💪
ayarse commentedon May 11, 2024
@JarrodMFlesch I'm still having this issue on
2.16.1.In my case, the issue is even stranger because the upload field doesn't return
nullfor every GraphQL request.When I spam the server with requests in Altair and I can see
nullbeing returned for like 1/10 requests. Can this be an unresolved promise or something?eweren commentedon May 12, 2024
Having the same as @ayarse for the beta branch. Seems to only occur on media relations,
avemeva commentedon Aug 1, 2024
Yes, seems like
betabranch doesn't have this fix yet.main:
https://github.com/payloadcms/payload/commits/main/test/collections-graphql/config.ts
beta:
https://github.com/payloadcms/payload/commits/beta/test/collections-graphql/config.ts
beta doesn't have
fix: graphql upload relations returning null #6233
Discussion on Discord:
https://discord.com/channels/967097582721572934/1268563926531182695
github-actions commentedon Sep 6, 2024
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.