Skip to content

njs doesn’t support await in arguments #4

@jirutka

Description

@jirutka
[emerg] 31478#31478: SyntaxError: await in arguments not supported in /home/gittu/njs-ssl/dist/main.js:5487

Googling that error code I find this:
nginx/njs@455f6d4

    { njs_str("async function f1() {try {f(await f1)} catch(e) {}}"),
      njs_str("SyntaxError: await in arguments not supported in 1") },

So thats the error. await isn't 100% supported, so when you remove async-await polyfill, it errors. So I guess it needs to be transpiled, maybe

fn(await fn2());

To

var r1 = await fn2();
fn(r1);

Another observation njs-acme project also uses "^0.2.1" https://github.com/nginx/njs-acme/blob/main/package.json#L57C6-L57C34

Originally posted by @sarim in nginx/njs#663 (comment)

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