Skip to content

Cannot set cloud variables #1

Description

@WilsontheWolf

I cannot set a cloud variable using this. The error I get is

(node:4069) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'set' of undefined
    at CloudSession.setVariable (/rbd/pnpm-volume/e38efa70-1bc7-452e-891e-f660e6a03dfd/node_modules/.registry.npmjs.org/node-scratch-client/1.3.7/node_modules/node-scratch-client/src/Struct/CloudSession.js:35:27)
at cloud.connect.then (/app/server.js:41:9)
(node:4069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4069) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
code:```js
const config = require("./config.json");
const scratch = require("node-scratch-client");

const Client = new scratch.Client({
  username: config.username,
  password: config.password
});

Client.login().then(() => {
  let cloud = Client.session.createCloudSession(221003966);

  cloud.connect().then(() => {
    cloud.on("set", variable => {
      console.log("Variable \""+variable.name+"\" changed to " + variable.value);
        
    });
  cloud.setVariable('☁ Test', 'Test')//seting her. ☁ Test exists
  });
});```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions