Skip to content

CloudSession doesn't work #3

@gohoski

Description

@gohoski

I am trying to create a CloudSession, but there is an error talking about this being undefined.
Error:

        this.send("handshake", {});
             ^

TypeError: Cannot read properties of undefined (reading 'send')
    at sendHandshake (D:\Skretchero-tekst\node_modules\scratch3-api\dist\cloudsession.js:127:14)
    at WebSocket.<anonymous> (D:\Skretchero-tekst\node_modules\scratch3-api\dist\cloudsession.js:47:13)
    at WebSocket.emit (node:events:402:35)
    at WebSocket.setSocket (D:\Skretchero-tekst\node_modules\ws\lib\websocket.js:225:10)
    at ClientRequest.<anonymous> (D:\Skretchero-tekst\node_modules\ws\lib\websocket.js:810:15)
    at ClientRequest.emit (node:events:390:28)
    at TLSSocket.socketOnData (node:_http_client:527:11)
    at TLSSocket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)

Code:

const Scratch = require('scratch3-api');
const { username, password } = require('./config.json');

async function main() {
	let session = await Scratch.UserSession.create(username, password);
	let cloud = await session.cloudSession(60*****78);
	/*cloud.on('set', (name, value) => {
		console.log(name, value);
	})*/
}

main();

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