Skip to content

Cannot read properties of undefined (reading 'send') #130

@paul-uz

Description

@paul-uz

Oddly, this has cropped up when testing on another environment.

ActiveMQ is up, and the Queue exists. I also opened the Stompit port for inbound traffic.

Works fine when testing on one environment, but not a new one. Code is the same, I've compared it using BeyondCompare.

stompAsync = async (index: number, url: string, title?: string) => {
    return new Promise<void>((resolve, reject) => {
      stompit.connect({
        host: `${process.env.MQ_ID}-1.mq.eu-west-1.amazonaws.com`,
        port: 61614,
        ssl: true,
        connectHeaders: {
          'login': 'xxx',
          'passcode': 'yyy',
        },
      }, (error: any, client: any) => {
        if (error) {
          reject(error);
        }
        let frame = client.send({ destination: 'TestQueue', AMQ_SCHEDULED_DELAY: index * 1000 }); // fails here
        frame.write(JSON.stringify({index: index, title: title, url: url, timeSent: new Date()}));
        frame.end();
        client.disconnect();
        resolve();
      });
    });
  };

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