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,
},
}
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.