Doesn't work
Package containing the bug
next-drupal (NPM package)
Describe the bug
All the app is retrieving from JSON:API is this, one for each node. No actual content.
{
type: 'node--article',
id: '0358b050-c872-45e2-8c5b-8cdfda4b59b3',
links: { self: [Object] }
},
I have found this to be the issue when using the jsona serializer. I will get the same results using the @drupal-api-client/json-api-client if I configure it to use the jsona serializer. Without jsona I get all of the data.
I have confirmed this on both a Drupal 10 and 11 sites. I have confirmed that if I hit the /jsonapi/node/article endpoint it returns all the data.
Thank you.
If you have authentication enabled, you won’t see any content until you grant the proper permissions to the user. Try making a request from an incognito window or using an app like Postman to check if the content is actually missing.
Got back to this today. Non authenticated browser (not logged in to the Drupal site). Still no data
export default async function Home() {
const nodes = await drupal.getResourceCollection<DrupalNode[]>(
"node--blog",
{
params: {
sort: "-created",
},
next: {
revalidate: 3600,
},
}
)
console.log(nodes)
This is all I get
{
type: 'node--blog',
id: '02ead523-2614-4201-9cdb-7eefc3269913',
links: { self: [Object] }
},
No authentication ID or Secret in .env.local If I go directly to the site /jsonapi/node/blog endpoint on the site I see all the data. If I use @drupal-api-client/json-api-client instead of next-drupal I get all the data UNLESS I use the json serializer, in which case I get the same results as above. Thanks.