Rocket.Chat server not finding Node modules imported by an app

Hello. I am new to developing for Rocket.Chat and I hope someone can help me with this problem.

I am trying to develop a simple slash command that makes use of the Node library ‘strong-soap’.
However, when I deploy this to the server with rc-apps deploy, the Node dependencies are not added to the package and the server is not able to locate ‘strong-soap’.

In my slashcommand.ts I have:

import {IModify, IRead} from '';
import {App} from '';
import {ISlashCommand, SlashCommandContext} from '';
import * as soap from 'strong-soap';

export class CercaCommand implements ISlashCommand {
    public command = 'cerca';
    public i18nDescription = '';
    public i18nParamsExample = '';
    public providesPreview = false;

    constructor(private readonly app: App) {}

    public async executor(context: SlashCommandContext, read: IRead, modify: IModify): Promise<void> {
        let message: string = 'Hello!';

        const messageStructure = await modify.getCreator().startMessage();
        const sender = context.getSender(); // the user calling the slashcommand
        const room = context.getRoom(); // the current room


        const urlWsdl = '';

        try {
            soap.soap.createClient(urlWsdl, {}, (err, client) => {
                console.log('Inside client');
        } catch (error) {

        await modify.getCreator().finish(messageStructure);

but when running /cerca the server logs the error:

rocketchat_1          | TypeError: Cannot read property 'soap' of undefined
rocketchat_1          |     at CercaCommand.executor (evalmachine.<anonymous>:24:18)
rocketchat_1          |     at runMicrotasks (<anonymous>)
rocketchat_1          |     at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is there a way to make the engine locate the strong-soap library on the server?
My server machine is a Docker container with image rocketchat/
Rocket.Chat version: 3.9.1
Apps engine version: 1.20.0
I tried running npm install strong-soap on several paths in the server – including the root folder of Rocket.Chat, the one containing main.js.
I also tried npm install -g strong-soap.
Neither worked.

It’s not supported yet. And the Apps are ran in a sandbox environment so they will not use the regular environment which is why installing it globally isn’t working.

1 Like

I see. I will have to access SOAP in some other way, then.
Thank you very much for replying and for the pointer.

1 Like