Closed littlefengers closed 3 weeks ago
I confirm, it doesn't work for me either
We have the same issue, had to downgrade
Yes same, even on a bare CRA
Can confirm this is still an issue. Reverted versions and works again.
Hey , thanks for raising this. Could any of you please provide more clarity on the query? The fetch call seems to be working on my side. Here's how I did it:
import contentstack from 'contentstack';
import 'dotenv/config';
const stack = contentstack.Stack({
api_key: process.env.API_KEY,
delivery_token: process.env.DELIVERY_TOKEN,
environment: process.env.ENVIRONMENT,
})
const result = await stack
.ContentType("author")
.Entry("bltf01a781af0dda942")
.toJSON()
.fetch();
console.log({ result });
cc @littlefengers @c0pp3rt0p
@nadeem-cs
Here's how we're currenlty calling it.
const Query = this._contentStack
.ContentType('author')
.Entry('bltf01a781af0dda942')
.includeContentType()
.includeEmbeddedItems()
.language(locale)
.includeFallback()
.includeReference('some_sub_type');
const content = (await Query.fetch()).toJSON();
@c0pp3rt0p the toJSON method should be called before fetch call. So your query would become
const Query = this._contentStack
.ContentType('author')
.Entry('bltf01a781af0dda942')
.includeContentType()
.includeEmbeddedItems()
.language(locale)
.includeFallback()
.includeReference('some_sub_type');
const content = await Query.toJSON().fetch();
Try this and let me know if that works.
@nadeem-cs Can you update the QuickStart guide? It does not designate that in the instructions here. The example it gives is
const Stack = Contentstack.Stack({ "api_key": "api_key", "delivery_token": "delivery_token", "environment": "environment" });
const entry = Stack.ContentType('blog').Entry("entry_uid");
const result = await entry.fetch()
@nadeem-cs That fixes my issues. Calling toJSON()
prior to fetch()
corrects the problem for my case. Thank you!
I had the same problem after upgrading from a previously working version, and calling toJSON()
before .fetch()
was the resolution that allowed me to use the latest package.
Closing the issue as it has been resolved
Hey, I'm getting this error when I try to pull a specific entry
Using:
let query = Stack.ContentType(contentTypeUid).Entry(entryUid)
Error fetching entries: { message: 'Cannot call a class as a function' }
I can still get all the entries if only providing contentId.
I can confirm that it works when I'm on 3.17.1