Different user behavior of js

Hi! We use your wonderful platform for internal admin tools, and in one case, we're experiencing strange behavior that we can't seem to fix.

There's a JS code that determines what's selected in the UI and makes a GraphQL request to our backend, and everything was working fine for a while. Recently, one of our users started encountering an error, which is shown in the screenshot:


However, another user has everything working fine, and the same form with the same data works correctly

How can we fix our form's functionality? It seems like the problem is on the platform's side, as the error indicates that something is missing in the Additional Scope, but you can see in the log that the necessary identifier for the request is there, and moreover, everything works for another user.

I tried to use local storage


but user have same problem

Now it is not working for all users. Here code js:

function setUserId(userId){
  localStorage.setValue('CurrentParams', {
    userId : userId,
  })
}


function addToBlackList() {
  if (ClientType.value === 'Individual') {
    getUserID.trigger({
      additionalScope:{
            email:ClientEmail.value.toLowerCase()
          },
      onSuccess: function(getUserIDResponse) {
        const userId = getUserIDResponse;
        setUserId(userId)
        
        
        add2BlackList.trigger({
          onSuccess: function() {
            isBannedQuestion.trigger(); 
          },
          onFailure: function(error) {
            console.error("AddToBlackList Individual Error :", error);
          }
        });
      },
      onFailure: function(error) {
        console.error("getUserID Error:", error);
      }
    });
  } else if (ClientType.value === 'Business') {
    let companyId = CompanySelect.value;
    console.log("Email:", ClientEmail.value);
console.log("Company ID:", CompanySelect.value);
  
   setUserId(companyId)
    console.log(localStorage.values)
    
    add2BlackList.trigger({
      onSuccess: function() {
        isBannedQuestion.trigger(); 
      },
      onFailure: function(error) {
        console.error("AddToBlackList Business Error:", error);
      }
    });
  }
}

addToBlackList();

When I click on button, always get error, but don't understand why:

And I don't see error in request

Hello, the problem seems to be in add2BlackList query since it is throwing its onFailure error message ("AddToBlackList Bussines Error:")

can you run add2BlackList separately and see if the error remains?

I think not, because when the problem is in the request, the request itself highlights the error, but in this case I don’t see an incoming request on our backend, and the retool doesn’t highlight anything


Hello, i think the problem is because GraphQL doesn't support additionalScopes (I don't see any additionalScopes field in it)

I guess you will need to use variables instead if there isn't another workaround

JS Query does have an additionalScopes field where you define them
image

1 Like

I have different queries graphQL where additional scope is working fine. But your variant is working or is it temporal solve, and after some time is will broke =(


Hi there,

I copy/pasted this code into my own app & the additionaScope is working :thinking: I don't believe we have any known bugs with additionalScope not working. Any chance I could see an export of your app to review further?

HI Tess! Very strange behavior, the application can work at the same time for example for me, but for another user the request fails with an error.

Banxe Bank Black list Admin Panel .json (457.1 KB)

Hi @Alex_Nazarenko,

We still haven't had similar reports of inconsistent behavior where it works for some users & not others, so I wanted to check in. If you are still seeing this issue & can grab a screen recording, that could help in moving towards a solution