mondaycom / monday-sdk-js

Node.js and JavaScript SDK for developing over the monday.com platform
https://monday.com
MIT License
87 stars 39 forks source link

[Bug] No error handling for calling monday.instance.getItem/setItem with a valid monday.setToken #89

Closed goodpilotfish closed 1 year ago

goodpilotfish commented 1 year ago

Describe the bug When experimenting with monday.instance.getItem/setItem I spent quite a bit of time debugging. It looks like it only works when running inside of Monday and not

Steps to reproduce Call the following code:

import mondaySdk from "monday-sdk-js";
const monday = mondaySdk();
monday.setToken(<correct token>);

monday.storage.instance.setItem('test', 'Lorem Ipsum').then(res => {
    console.log(res);
    monday.storage.instance.getItem('test').then(res => {
      console.log(res);
      console.log(res.data.value);
    });
  });

The structure printed is the follwing: // setItem args: {method: 'set', key: 'test', value: 'Lorem Ipsum', options: {…}, segment: 'instance'} clientId: undefined method: "storage" requestId: "gwtl9xq" version: "0.1.6"

// getItem args: {method: 'get', key: 'test', options: {…}, segment: 'instance'} clientId: undefined method: "storage" requestId: "wgzie0e" version: "0.3.0" ``

Expected behavior A clear error or success: false when running it with a token. I know that you can't set "storage" in the oath settings, still a clear error would save devs time.

Workaround: Check for clientId === undefined.

goodpilotfish commented 1 year ago

Might just be a feature. Closing this as I found a more critical bug and don't want to pollute the issue list. Might recreate this when the storage API is working as expected.