The problem appears to be when the page is executing in preview mode. When published, the console logs fire correctly and everything behaves. .
Hi all, I have a simple GetPost() which is not working:
$w.onReady(function () {
$w('#post1').getPost().then( (post) => {
console.log("We have the post")
})
.catch((error) => {
console.log('We have an error')
console.log(error);
The page post object is definitely #post1.
... each time I run this I get an error as follows:
We have an error
TypeError: Cannot read properties of undefined (reading '0')
If I modify the getPost() to this it still yields the same result
$w('#post1').getPost().then( async (post) => {console.log("We have the post")}).catch((error) => {console.log('We have an error')console.log(error);});}
Any ideas what's going on? Could the post database be corrupted?
Hello @curator ,
The issue should be resolved now, please check and tell me if everything is working as it should.
Hello @curator ,
This seems to happen only to published sites, sites that are not yet published work with the "getPost" function just fine in preview.
Thank you for reporting this issue. We are aware of it and are currently investigating it. Once the issue is fixed I'll let you know.
Thank you for your understanding