Rocket.Chat.Apps-engine icon indicating copy to clipboard operation
Rocket.Chat.Apps-engine copied to clipboard

Compiling to broken code

Open dbrekelmans opened this issue 6 years ago • 6 comments

I'm running rc-apps deploy on the latest release.

It seems to compile my valid typescript to some broken code. It looks like it cannot resolve the import properly.

I reverted rc-apps to 1.4.0 (on which I had this code successfully working 4 months ago) and the same thing happened. Maybe it has something to do with the typescript version I'm using (3.6.3)?

import {IConfigurationExtend, IEnvironmentRead} from '@rocket.chat/apps-engine/definition/accessors';
import {App} from '@rocket.chat/apps-engine/definition/App';
import {RemindCommand} from './command/RemindCommand';

export class Reminder extends App {
    protected async extendConfiguration(
        configuration: IConfigurationExtend,
        environmentRead: IEnvironmentRead,
    ): Promise<void> {
        await configuration.slashCommands.provideSlashCommand(new RemindCommand());
    }
}
Screenshot 2019-10-09 at 10 51 05

I'm running this in a docker container:

FROM node:latest

RUN npm install -g typescript @rocket.chat/apps-cli

This is my directory structure, just to confirm to you that the RemindCommand.ts exists. Screenshot 2019-10-09 at 11 01 36

And my app.json

{
    "id": "c839f5a6-65fa-4d17-b819-17d5c06f550f",
    "version": "0.0.1",
    "requiredApiVersion": "^1.4.0",
    "iconFile": "res/icon.png",
    "name": "reminder",
    "nameSlug": "reminder",
    "classFile": "src/Reminder.ts",
    "description": "Set reminders for a user or channel with the /remind command."
}

dbrekelmans avatar Oct 09 '19 09:10 dbrekelmans

All the CLI does it zips up the files, it doesn't actually compile anything to javascript and keeps it as TypeScript. @d-gubert any idea for what's going on?

graywolf336 avatar Oct 09 '19 15:10 graywolf336

I've never seen this happen 🤔

Can you check the zip file generated by the deploy command and validate that it has only typescript code?

The docker image you're using is solely for executing the CLI?

d-gubert avatar Oct 09 '19 19:10 d-gubert

@d-gubert I can confirm that the files in the zip are identical to the source files.

Yes, I have this docker image so I don't have to install node and other dependencies on my machine. In a different container I run the rocketchat server, though that should not matter.

I made my repo public so you can have a look and see if you can reproduce this issue. https://github.com/dbrekelmans/reminder-rc-app

dbrekelmans avatar Oct 12 '19 09:10 dbrekelmans

This seems like a bug in the apps-engine to me since it the cli only zips the files. Would you like me to repost this issue there?

dbrekelmans avatar Oct 13 '19 07:10 dbrekelmans

Hi @dbrekelmans , which apps-engine version do you use?

shiqimei avatar Oct 21 '19 10:10 shiqimei

Hi @lolimay, in my package.json I put ^1.6.0, so the latest version.

You can use my repo to reproduce this issue: https://github.com/dbrekelmans/reminder-rc-app

dbrekelmans avatar Oct 21 '19 11:10 dbrekelmans