Hey there! I have an issue where I query a document that has a richtext field, with an uploaded image within the richtext instance. However, the link value is returning null and I can't figure out why.
The Richtext field is configured like so:
{
name: 'richText',
type: 'richText',
admin: {
upload: {
collections: {
media: {
fields: [
{
type: 'richText',
name: 'caption',
label: 'Caption',
admin: {
elements: [...elements],
leaves: [...leaves],
},
},
],
},
},
},
},
},
And my media collection looks like this:
const Media: CollectionConfig = {
slug: 'media',
upload: {
disableLocalStorage: true,
staticURL: '/media',
staticDir: 'media',
mimeTypes: ['image/*'],
adminThumbnail: ({ doc }) =>
`https://westeroscraft.s3.amazonaws.com/media/images/${doc.filename}`,
imageSizes: [
{
height: 400,
width: 400,
crop: 'center',
name: 'thumbnail',
},
{
width: 900,
height: 450,
crop: 'center',
name: 'sixteenByNineMedium',
},
],
},
fields: [],
}
When I query, this is whats returned
"richText": [
{
"type": "upload",
"value": null,
"relationTo": "media"
},
],
Any clarity on what I may be missing is appreciated!
Figured it out finally - needed to add read access on the collection
{
slug: 'media',
access: {
read: () => true,
},
}
Hi, I have the same problem
already checked permissions (read)
api response is still
{
"children": [
{
"text": ""
}
],
"relationTo": "media",
"type": "upload",
"value": null
},
what can I do to fix this?
This is the same issue I’m having over here too:
https://discord.com/channels/967097582721572934/1237518185826357301In case you wanted to drop that in an unanswered thread
found it
using @payloadcms/richtext-slate 1.5.2 I have this problem.
downgrading to 1.5.0 it is solved
maybe a bug?
Star
Discord
online
Get dedicated engineering support directly from the Payload team.