Monday Storage API "cannot read property 'instance' of undefined"

   static async getXP(token, userId) {
try {
  const mondayClient = initMondayClient();
  mondayClient.setToken(token);

  const response = await mondayClient.storage.instance.getItem('USER' + userId).then(res => {
    console.log(res.data.value);
    return res;
  }).catch(err => {
    console.log(err);
    return err;
  });

  return response;
} catch (err) {
  console.log(err);
}

}

I am getting an error stating that mondayClient.storage is undefined and so its property ‘instance’ cannot be read. I know mondayClient is defined because I can query the GraphQL API. I am trying to access the storage API from a Node js back end. Can the storage API only be accessed from the client or something, or am I just not seeing my mistake?

Hi @hrustad1017

Welcome to the community. As far as I understand the .storage is indeed client side only (although I might be wrong here). I am using a SQL/MariaDB to store values.

Thank you, I was thinking that was the issue.

1 Like

Is execute also client side only?

1 Like

It is my understanding that only monday.api is available for server side apps (like the backend of an integration). Can somebody from monday.com please confirm or comment and if so change the documentation accordingly?

I agree, or at least label which ones are server and which are client.

I just submitted a pull request with an update to the documentation. Not sure if my addition was styled the best, but it should at least get the ball rolling I hope.

1 Like

Apparently the README in the monday-sdk-js GitHub repository does say which capabilities are client side only, but it is easy to miss.

1 Like

Hey folks! Sounds like you figured it out, but I just wanted to confirm:

  1. Yes, the storage API is only accessible from the client side
  2. The monday.API call can be used on the client- or server-side. If you use monday.api on the client side you will enjoy seamless authentication as well :slight_smile:
  3. At the moment the only server-side method is monday.api, but watch this space!
1 Like

Could you add whether or not capabilities are available server side in the capabilities table of the monday-sdk-js readme on github? If you don’t work on that personally could you please get someone to do it?