I just previewed a page that is built for quite a bit and the console is now showing this error message. Any clues? Anyone?
++
We cannot read the small words on the screenshot. Please write the message and post the code on the page. Read the community guidelines on how to make a new post for the Corvid forum.
Provide as many details as possible . Describe the context of the problem, what you are trying to achieve, and the steps you’ve taken so far.
Include a short snippet of the relevant code that you’re using. The code should be properly formatted and in a code block, not a screenshot.
Hi Shan, this is my code on the page
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
import wixUsers from ‘wix-users’;
const user = wixUsers.currentUser;
const userId = user.id;
const isLoggedIn = user.loggedIn;
$w.onReady( function () {
$w(‘#ambassadorButton’).hide();
$w(“#repeater1”).onItemReady( ($w, AmbCamp) => {
console.log(AmbCamp.campaignStatus);
if (AmbCamp.campaignStatus === true ) {
$w(“#openCampbutton”).label = “Open”;
}
else {
$w(“#openCampButton”).hide();
}
});
//Do this only if the user is logged in
if (isLoggedIn){
//Get the user email, and do the query on private members data to match email
user.getEmail().then((email)=> {
let userEmail = email;
console.log("Email: " + userEmail);
wixData.query(“Members/PrivateMembersData”)
.eq(“loginEmail”, userEmail)
.find()
.then( (results) => {
//if we get a match, do a query for the points
if (results.items.length > 0) {
//Here we do the query for the points, and we scan the results when the promise is fullfilled
wixData.query(“AmbRewards”)
.eq(“ambassadorMember”, results.items[0]._id)
.find()
.then( (res) => {
if (res.items.length > 0) {
//log results
console.log(res);
//Found the points relative to the email, set points to visual element
$w(‘#points’).text = res.items[0].points;
console.log($w(‘#points’).text);
}
else {
// handle case where no matching items found
}
});
}
else {
// handle case where no matching items found
}
});
});
}
});
and this is the error message I get
{…}
"missing_context, details: {"fields":"MSID / (appDefId, instanceId)","apps":"null","entities":"{\"context\":{\"appDefId\":\"eb377299-86b4-4a86-a1b5-774a2d1d374b\"},\"identities\":[{\"service\":{\"appDefId\":\"eb377299-86b4-4a86-a1b5-774a2d1d374b\"}}]}"}"message:
details:
{…}
"{"context":{"appDefId":"eb377299-86b4-4a86-a1b5-774a2d1d374b"},"identities":[{"service":{"appDefId":"eb377299-86b4-4a86-a1b5-774a2d1d374b"}}]}"entities:
"missing_context"error:
"MSID / (appDefId, instanceId)"fields:
"api_error"category:
nullapps:
For starters don’t test your site in the Wix preview when you are using certain API like Wix Users.
https://www.wix.com/corvid/reference/wix-users.html
-
The APIs in wix-users are only partially functional when previewing your site. View a published version of your site to see their complete functionality.
-
The APIs in wix-users can only be used once the page has loaded. Therefore, you must use them in code that is contained in or is called from the onReady() event handler or any element event handler.
Hi Gos, thanks for the reply. I normally inspect the site on the published page. My question was more because this page never printed that error before (even in preview mode) and I didn’t touch the site for a couple of weeks. Today when I came back from holidays to work on it, started displaying this.
I’ve reread your code and noticed that you query the Wix Members app collection.
wixData.query(“Members/PrivateMembersData”)
Therefore, that is causing your issue as currently this collection has it’s permission set to admin, when it should be site member author.
This is a known bug and is being looked into with a fix coming soon hopefully.
If you look through the forum posts for last few days, you will see other posts about it too.
You can workaround it at present by making use of Wix Data Options.
https://www.wix.com/corvid/reference/wix-data.html#WixDataOptions