When I view my CMS on my machine, I see the full relationship:
{
"format": "",
"type": "relationship",
"version": 1,
"relationTo": "addresses",
"value": {
"id": "6508ec3945c357227a95e85c",
"locationName": "Mailing Address",
"streetAddress": "*****",
"city": "North Chesterfield",
"state": "VA",
"zip": "23235",
"createdAt": "2023-09-19T00:32:57.541Z",
"updatedAt": "2023-09-21T15:56:37.797Z",
"country": "",
"optionalAdditionalStreetAddress": "*****"
}
}But when I view it in production, this is what I see:
{
"format": "",
"type": "relationship",
"version": 1,
"relationTo": "addresses",
"value": null
}Am I missing a configuration to make the relationship return the correct value?
Here are my versions:
"dependencies": {
"@aws-sdk/client-s3": "^3.468.0",
"@aws-sdk/lib-storage": "^3.468.0",
"@payloadcms/bundler-webpack": "^1.0.6",
"@payloadcms/db-mongodb": "^1.4.1",
"@payloadcms/plugin-cloud-storage": "^1.1.1",
"@payloadcms/richtext-lexical": "^0.6.1",
"@swc/core": "^1.3.92",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"nodemailer-sendgrid": "^1.0.3",
"payload": "^2.11.0"
},Depth is the same level and other relationships populate correctly.
Actually, I lied - no relationship is working in production
The relationship shows up properly in my MongoDB, as well
Just bumping this up. Hoping to have someone take a look or help me with troubleshooting
Morning!
So you're saying no relationships work in prod?
Correct! In local dev, I’m able to see the full relationship in my API section. When Payload is deployed and I’m in my actual prod CMS, the value is null.
Weirddd
Payload version?
2.11.0
Postgres?
oh mongo
If deployment matters, I provisioned Mongo from Railway
I'm not sure if it does, it's odd to me that your compiled collections are returning different information
It’s baffling to me. I see the id in my db but not in prod
can i see the field config in collection setup
I’ll need a few minutes before I can fire that up. If you’re looking for read access, though, that is set properly. I’m able to query the collection when it’s not a relationship in richtext (lexical)
just wanted to see how the relation is setup
very odd
I wonder if
@858693520012476436knows anything about this
here's the collection:
import {CollectionConfig} from 'payload/types';
import {userPerms} from "../utilities/permissions";
const Addresses: CollectionConfig = {
slug: 'addresses',
admin: {
useAsTitle: 'locationName',
group: 'Admin'
},
access: {
read: () => true,
create: userPerms,
update: userPerms,
delete: userPerms,
},
fields: [
{
name: 'locationName',
type: 'text',
required: true,
},
{
name: 'streetAddress',
type: 'text',
required: true,
},
{
name: 'optionalAdditionalStreetAddress',
type: 'text',
},
{
name: 'city',
type: 'text',
required: true,
},
{
name: 'state',
type: 'text',
required: true,
},
{
name: 'zip',
type: 'text',
required: true,
},
{
name: 'country',
type: 'text',
},
{
name: 'meetingAddress',
label: 'Is this the meeting address?',
type: 'checkbox',
},
],
}
export default Addresses;Lexical config:
editor: lexicalEditor({
features: ({defaultFeatures}) => [
...defaultFeatures,
LinkFeature({}),
RelationshipFeature({}), // added for troubleshooting
SlateToLexicalFeature(),
BlocksFeature({
blocks: [
CTAs, ContentWithMedia
]
})
]
}),wheres the relationship
In the Lexical config from the defaults. I can select the relationship
I'll check that in a second, but first a few more screenshots
does it need ` enabledCollections
local:
right
may have some insight too, he made this one
Prod:
Sorry for the spam, I'll check the resource you sent!
(and
@360823574644129795and
@858693520012476436since you all were mentioned above) - I tried
enabledCollectionsin the
RelationshipFeatureand
enableRichTextRelationshipat the collection level - none of those worked. From the docs, all of those default to
trueanyway, which would be why I can select them in my Lexical editor and (in theory) should be able to query it in prod
could it be just access issue?
Access is set to
access: {read: () => true, // more code}and I'm able to query the collection outside of the relationship.
Can you
Make a normal relationship, outside of lexical
and see if that gets populated?
We should narrow down if this is specific to relationships, or lexical relationship feature
yep! see attached.
and its not populated?
Can we see the field configs
Oh sorry, that is populated. First screenshot is local, second is prod.
{name: 'testAddressRelationship',
type: 'relationship',
relationTo: 'addresses',
},i'm going to try querying on the front end in just a minute
I would try reproducing it in the latest 3.x beta release of lexical. There's been tons of changes related to population within lexical in 3.0, and we likely won't backport those fixes to 2.0
There's a good chance this is fixed in 3.x
I'll give it a shot, thank you
just to clarify - you do mean payload 3.x?
Yes they do
It appears that upgrading to 3.x solves this issue. I look forward to the stable version!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.