Rocket.Chat.Apps-engine
Rocket.Chat.Apps-engine copied to clipboard
Configured environment is not supported yet
When I am trying to deploy my app using rc-apps deploy
, I get the following error:
> node_modules/fetch-blob/from.js:83:2: error: Transforming async generator functions to the configured target environment ("node10") is not supported yet
83 │ async * stream () {
╵ ~~~~~
> node_modules/node-fetch/src/body.js:223:6: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
223 │ for await (const chunk of body) {
╵ ~~~~~
> node_modules/fetch-blob/index.js:12:0: error: Transforming async generator functions to the configured target environment ("node10") is not supported yet
12 │ async function * toIterator (parts, clone = true) {
╵ ~~~~~
> node_modules/fetch-blob/index.js:122:8: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
122 │ for await (const part of toIterator(this.#parts, false)) {
╵ ~~~~~
> node_modules/fetch-blob/index.js:145:8: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
145 │ for await (const chunk of toIterator(this.#parts, false)) {
╵ ~~~~~
> node_modules/web-streams-polyfill/dist/ponyfill.es2018.js:519:79: error: Transforming async generator functions to the configured target environment ("node10") is not supported yet
519 │ const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () { }).prototype);
╵ ~~~~~
> node_modules/node-fetch/src/utils/multipart-parser.js:425:5: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
425 │ for await (const chunk of Body) {
╵ ~~~~~
Packaging the app... ✖
› Error: ⟿ Build failed with 7 errors:
› node_modules/fetch-blob/from.js:83:2: error: Transforming async generator functions to the configured target environment ("node10") is not supported yet
› node_modules/fetch-blob/index.js:12:0: error: Transforming async generator functions to the configured target environment ("node10") is not supported yet
› node_modules/fetch-blob/index.js:122:8: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
› node_modules/fetch-blob/index.js:145:8: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
› node_modules/node-fetch/src/body.js:223:6: error: Transforming for-await loops to the configured target environment ("node10") is not supported yet
Is this error occuring due to a bug within RC or the library node-fetch
?My current code is:
import {
IHttp,
IModify,
IRead,
} from '@rocket.chat/apps-engine/definition/accessors';
import fetch from 'node-fetch';
import {
ISlashCommand,
SlashCommandContext,
} from '@rocket.chat/apps-engine/definition/slashcommands';
export class n implements ISlashCommand {
public command = 'n';
public i18nParamsExample = '';
public i18nDescription = '';
public providesPreview = false;
public async executor(context: SlashCommandContext, read: IRead, modify: IModify, http: IHttp): Promise<void> {
const supply = '{"fields": {"project": {"key": "TEST"},"summary": "TEST the API","description": "testing API","issuetype": {"name": "Bug"},"customfield_11050": "idk."}}'
const response = await fetch('http://localhost:3000/', {
method: 'post',
body: JSON.stringify(supply),
headers: {'Content-Type': 'application/json'}
});
const data = await response.json();
console.log(data);
};
};
My tsconfig.json file looks like this:
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"strictNullChecks": true,
"noImplicitReturns": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
},
"include": [
"**/*.ts"
]
}
Your Environment
software | version |
---|---|
node-fetch | 3.3.1 |
node | 18.16.0 |
npm | 9.5.1 |
Operating System | Linux Ubuntu |
Check this -
change tsconfig.json file
"compilerOptions": { "target": "es2017", "module": "commonjs", ....... },
to this
"compilerOptions": { "target": "esnext", "module": "commonjs", .......... },
Check this -
change tsconfig.json file
"compilerOptions": { "target": "es2017", "module": "commonjs", ....... },
to this
"compilerOptions": { "target": "esnext", "module": "commonjs", .......... },
Unfortunately, the same error occurs still. Any other ideas please?
Moving this issue to the https://github.com/RocketChat/Rocket.Chat.Apps-engine repo