Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configured environment is not supported yet #615

Open
EngineerHus opened this issue Apr 25, 2023 · 3 comments
Open

Configured environment is not supported yet #615

EngineerHus opened this issue Apr 25, 2023 · 3 comments

Comments

@EngineerHus
Copy link

EngineerHus commented Apr 25, 2023

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
@iamalbinnj
Copy link

Check this -

change tsconfig.json file

"compilerOptions": {
"target": "es2017",
"module": "commonjs",
.......
},

to this

"compilerOptions": {
"target": "esnext",
"module": "commonjs",
..........
},

@EngineerHus
Copy link
Author

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?

@hugocostadev
Copy link

Moving this issue to the https://github.com/RocketChat/Rocket.Chat.Apps-engine repo

@tapiarafael tapiarafael transferred this issue from RocketChat/Rocket.Chat Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants