[GH-ISSUE #285] Unexpected reserved word 'await' #66

Open
opened 2026-03-03 13:52:42 +03:00 by kerem · 14 comments
Owner

Originally created by @TheGreyRaven on GitHub (Jan 21, 2025).
Original GitHub issue: https://github.com/jehna/humanify/issues/285

root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:359
    const error = new SyntaxError();
                  ^

SyntaxError: unknown: Unexpected reserved word 'await'. (638:6)

  636 |         return true;
  637 |       };
> 638 |       await _0x1f488e();
      |       ^
  639 |       clearInterval(_0x284d18);
  640 |       _0x284d18 = setInterval(_0x1f488e, 1000);
  641 |       $("#p_div_panel").show();
    at constructor (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:359:19)
    at Parser.raise (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:3327:19)
    at Parser.checkReservedWord (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11878:12)
    at Parser.parseIdentifierName (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11858:12)
    at Parser.parseIdentifier (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11833:23)
    at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11076:27)
    at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23)
    at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21)
    at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23)
    at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61)
    at Parser.parseExprOps (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10558:23)
    at Parser.parseMaybeConditional (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10535:23)
    at Parser.parseMaybeAssign (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10498:21)
    at Parser.parseExpressionBase (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10452:23)
    at /root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10448:39
    at Parser.allowInAnd (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12064:16)
    at Parser.parseExpression (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10448:17)
    at Parser.parseStatementContent (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12508:23)
    at Parser.parseStatementLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12375:17)
    at Parser.parseStatementListItem (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12355:17)
    at Parser.parseBlockOrModuleBlockBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12929:61)
    at Parser.parseBlockBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12922:10)
    at Parser.parseBlock (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12910:10)
    at Parser.parseFunctionBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11752:24)
    at Parser.parseFunctionBodyAndFinish (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11738:10)
    at Parser.parseMethod (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11696:31)
    at Parser.parseObjectMethod (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11599:19)
    at Parser.parseObjPropValue (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11630:23)
    at Parser.parsePropertyDefinition (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11570:17)
    at Parser.parseObjectLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11485:21)
    at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11000:23)
    at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23)
    at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21)
    at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23)
    at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61)
    at Parser.parseExprOps (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10558:23)
    at Parser.parseMaybeConditional (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10535:23)
    at Parser.parseMaybeAssign (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10498:21)
    at /root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10468:39
    at Parser.allowInAnd (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12069:12)
    at Parser.parseMaybeAssignAllowIn (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10468:17)
    at Parser.parseObjectProperty (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11605:83)
    at Parser.parseObjPropValue (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11630:100)
    at Parser.parsePropertyDefinition (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11570:17)
    at Parser.parseObjectLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11485:21)
    at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11000:23)
    at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23)
    at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21)
    at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23)
    at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61) {
  code: 'BABEL_PARSE_ERROR',
  reasonCode: 'UnexpectedReservedWord',
  loc: Position { line: 638, column: 6, index: 21637 },
  pos: 21637,
  syntaxPlugin: undefined
}

I have a quite heavily obfuscated file that fails with the following error shown above.
Not sure what you might need to debug this further, let me know and I can assist with both the file that I'm trying to deobfuscate.

I had a few other files that also contained some awaits and such and those files successfully deobfuscated, so not sure what might be the issue.
Also I'm running the local 2b to deobfuscate.

Originally created by @TheGreyRaven on GitHub (Jan 21, 2025). Original GitHub issue: https://github.com/jehna/humanify/issues/285 ```bash root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:359 const error = new SyntaxError(); ^ SyntaxError: unknown: Unexpected reserved word 'await'. (638:6) 636 | return true; 637 | }; > 638 | await _0x1f488e(); | ^ 639 | clearInterval(_0x284d18); 640 | _0x284d18 = setInterval(_0x1f488e, 1000); 641 | $("#p_div_panel").show(); at constructor (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:359:19) at Parser.raise (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:3327:19) at Parser.checkReservedWord (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11878:12) at Parser.parseIdentifierName (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11858:12) at Parser.parseIdentifier (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11833:23) at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11076:27) at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23) at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21) at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23) at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61) at Parser.parseExprOps (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10558:23) at Parser.parseMaybeConditional (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10535:23) at Parser.parseMaybeAssign (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10498:21) at Parser.parseExpressionBase (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10452:23) at /root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10448:39 at Parser.allowInAnd (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12064:16) at Parser.parseExpression (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10448:17) at Parser.parseStatementContent (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12508:23) at Parser.parseStatementLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12375:17) at Parser.parseStatementListItem (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12355:17) at Parser.parseBlockOrModuleBlockBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12929:61) at Parser.parseBlockBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12922:10) at Parser.parseBlock (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12910:10) at Parser.parseFunctionBody (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11752:24) at Parser.parseFunctionBodyAndFinish (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11738:10) at Parser.parseMethod (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11696:31) at Parser.parseObjectMethod (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11599:19) at Parser.parseObjPropValue (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11630:23) at Parser.parsePropertyDefinition (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11570:17) at Parser.parseObjectLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11485:21) at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11000:23) at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23) at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21) at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23) at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61) at Parser.parseExprOps (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10558:23) at Parser.parseMaybeConditional (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10535:23) at Parser.parseMaybeAssign (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10498:21) at /root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10468:39 at Parser.allowInAnd (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12069:12) at Parser.parseMaybeAssignAllowIn (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10468:17) at Parser.parseObjectProperty (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11605:83) at Parser.parseObjPropValue (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11630:100) at Parser.parsePropertyDefinition (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11570:17) at Parser.parseObjectLike (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11485:21) at Parser.parseExprAtom (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11000:23) at Parser.parseExprSubscripts (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10734:23) at Parser.parseUpdate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10719:21) at Parser.parseMaybeUnary (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10699:23) at Parser.parseMaybeUnaryOrPrivate (/root/.local/share/fnm/node-versions/v22.13.0/installation/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10553:61) { code: 'BABEL_PARSE_ERROR', reasonCode: 'UnexpectedReservedWord', loc: Position { line: 638, column: 6, index: 21637 }, pos: 21637, syntaxPlugin: undefined } ``` I have a quite heavily obfuscated file that fails with the following error shown above. Not sure what you might need to debug this further, let me know and I can assist with both the file that I'm trying to deobfuscate. I had a few other files that also contained some awaits and such and those files successfully deobfuscated, so not sure what might be the issue. Also I'm running the local 2b to deobfuscate.
Author
Owner

@0xdevalias commented on GitHub (Jan 22, 2025):

@TheGreyRaven I would probably start by seeing if bumping to the latest version of @j4k0xb 's webcrack resolves the issue:

If it does, then the version in humanify needs to be updated.

If not and the issue is still present there, then it's probably worth opening an upstream issue and providing an ideally minimal example of the code to reproduce the error:

If not, but it works upstream, then providing an ideally minimal example of the code to reproduce the error here would make the most sense I think.

<!-- gh-comment-id:2606251925 --> @0xdevalias commented on GitHub (Jan 22, 2025): @TheGreyRaven I would probably start by seeing if bumping to the latest version of @j4k0xb 's `webcrack` resolves the issue: - https://github.com/j4k0xb/webcrack - Online IDE: https://webcrack.netlify.app/ If it does, then the version in `humanify` needs to be updated. If not and the issue is still present there, then it's probably worth opening an upstream issue and providing an ideally minimal example of the code to reproduce the error: - https://github.com/j4k0xb/webcrack If not, but it works upstream, then providing an ideally minimal example of the code to reproduce the error here would make the most sense I think.
Author
Owner

@TheGreyRaven commented on GitHub (Jan 22, 2025):

Ah I see, I tested pasting the obfuscated code into their online ide and there it deobuscated most of the code just fine.
Perhaps a version update would be a good idea!

<!-- gh-comment-id:2608008033 --> @TheGreyRaven commented on GitHub (Jan 22, 2025): Ah I see, I tested pasting the obfuscated code into their online ide and there it deobuscated most of the code just fine. Perhaps a version update would be a good idea!
Author
Owner

@0xdevalias commented on GitHub (Jan 23, 2025):

This project currently seems to be using 2.13.0:

github.com/jehna/humanify@f6a2190bc5/package.json (L62)

Latest webcrack seems to be 2.15.0:

@TheGreyRaven If you feel like doing a little more digging, it would be useful to know if you get the same error running webcrack directly on version 2.13.0, and which newer version seems to fix it. That would help provide relevant context for this bug report.

<!-- gh-comment-id:2608751029 --> @0xdevalias commented on GitHub (Jan 23, 2025): This project currently seems to be using `2.13.0`: https://github.com/jehna/humanify/blob/f6a2190bc54572220a0cbff5b21cc2d7b283dcee/package.json#L62 Latest `webcrack` seems to be `2.15.0`: - https://github.com/j4k0xb/webcrack/releases - https://github.com/j4k0xb/webcrack/releases/tag/v2.14.0 - https://github.com/j4k0xb/webcrack/releases/tag/v2.14.1 - https://github.com/j4k0xb/webcrack/releases/tag/v2.15.0 @TheGreyRaven If you feel like doing a little more digging, it would be useful to know if you get the same error running `webcrack` directly on version `2.13.0`, and which newer version seems to fix it. That would help provide relevant context for this bug report. - https://github.com/j4k0xb/webcrack#command-line-interface
Author
Owner

@j4k0xb commented on GitHub (Jan 23, 2025):

I remember a similar discussion regarding the version in this repo
It should already use the latest version due to the ^?

Since it works fine the first time I assume the generated code get's corrupted at some point.
Remember that the babel parser is used by humanify itself, webcrack, and prettier.

<!-- gh-comment-id:2608753531 --> @j4k0xb commented on GitHub (Jan 23, 2025): I remember a similar discussion regarding the version in this repo It should already use the latest version due to the `^`? Since it works fine the first time I assume the generated code get's corrupted at some point. Remember that the babel parser is used by humanify itself, webcrack, and prettier.
Author
Owner

@brianjenkins94 commented on GitHub (Jan 23, 2025):

You can use overrides for quick testing:

https://github.com/jehna/humanify/issues/67#issuecomment-2422990106

<!-- gh-comment-id:2608774430 --> @brianjenkins94 commented on GitHub (Jan 23, 2025): You can use `overrides` for quick testing: https://github.com/jehna/humanify/issues/67#issuecomment-2422990106
Author
Owner

@VivaLaPanda commented on GitHub (Jan 31, 2025):

With overriding to latest webcrack, I still see this

<!-- gh-comment-id:2628569884 --> @VivaLaPanda commented on GitHub (Jan 31, 2025): With overriding to latest webcrack, I still see this
Author
Owner

@0xdevalias commented on GitHub (Feb 6, 2025):

With overriding to latest webcrack, I still see this

@VivaLaPanda Thanks for checking.

If not, but it works upstream, then providing an ideally minimal example of the code to reproduce the error here would make the most sense I think.

@TheGreyRaven / @VivaLaPanda Since it sounds like the issue is in humanify rather than webcrack, it would be useful to have an (ideally minimal, but any is better than none) example code that triggers this error; to help narrow down exactly where it's being caused.

<!-- gh-comment-id:2638460990 --> @0xdevalias commented on GitHub (Feb 6, 2025): > With overriding to latest webcrack, I still see this @VivaLaPanda Thanks for checking. > If not, but it works upstream, then providing an ideally minimal example of the code to reproduce the error here would make the most sense I think. @TheGreyRaven / @VivaLaPanda Since it sounds like the issue is in `humanify` rather than `webcrack`, it would be useful to have an (ideally minimal, but any is better than none) example code that triggers this error; to help narrow down exactly where it's being caused.
Author
Owner

@fosteman commented on GitHub (Feb 7, 2025):

this seems to fix it:

https://github.com/jehna/humanify/compare/main...fosteman:humanify:main

although, i am skipping the problem instead of dealing with it.

<!-- gh-comment-id:2641735054 --> @fosteman commented on GitHub (Feb 7, 2025): this seems to fix it: https://github.com/jehna/humanify/compare/main...fosteman:humanify:main although, i am skipping the problem instead of dealing with it.
Author
Owner

@0xdevalias commented on GitHub (Feb 7, 2025):

this seems to fix it:

main...fosteman:humanify:main

This seems to create a plugin that logs a console.error, and then skips the entire Program:

const syntaxErrorPlugin: PluginItem = {
  visitor: {
    Program(path) {
      // Example: this would log an error and allow Babel to continue parsing
      console.error("Syntax error encountered. skipping", path);
      path.skip();
    }
  }
};

Which is then added at the end of transformWithPlugins.

@fosteman Can you explain how this fixes the issue? From my quick / naive read.. this looks like it would just skip running any processing against the code at all; so while yes, it would technically skip the issue, I believe it would also skip doing anything at all wouldn't it?

Do you have a code sample where this issue was natively occurring? I would like someone to be able to provide a real-world sample so we can actually debug this issue properly and see exactly where/why it's occurring.


Edit: Resurrecting the stack trace from your edit:

Stack Trace
Processing file 1/538
Processing: 100%
Processing file 2/538
/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360
const error = new SyntaxError();
^

SyntaxError: unknown: Unexpected reserved word 'await'. (3:4)

1 | module.exports = {
2 | showProjectGroupAccessDeniedModal() {
> 3 | await swal.fire({
| ^
4 | icon: "error",
5 | title: "Access Denied",
6 | text: "You don't have the required permissions to access this project group.",
at constructor (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360:19)
at Parser.raise (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:3327:19)
at Parser.checkReservedWord (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11899:12)
at Parser.parseIdentifierName (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11879:12)
at Parser.parseIdentifier (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11854:23)
at Parser.parseExprAtom (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11090:27)
at Parser.parseExprSubscripts (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10748:23)
at Parser.parseUpdate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10733:21)
at Parser.parseMaybeUnary (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10713:23)
at Parser.parseMaybeUnaryOrPrivate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10566:61)
at Parser.parseExprOps (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10571:23)
at Parser.parseMaybeConditional (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10548:23)
at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10511:21)
at Parser.parseExpressionBase (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10465:23)
at /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:39
at Parser.allowInAnd (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12085:16)
at Parser.parseExpression (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:17)
at Parser.parseStatementContent (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12529:23)
at Parser.parseStatementLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12396:17)
at Parser.parseStatementListItem (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12376:17)
at Parser.parseBlockOrModuleBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12950:61)
at Parser.parseBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12943:10)
at Parser.parseBlock (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12931:10)
at Parser.parseFunctionBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11773:24)
at Parser.parseFunctionBodyAndFinish (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11759:10)
at Parser.parseMethod (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11717:31)
at Parser.parseObjectMethod (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11620:19)
at Parser.parseObjPropValue (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11651:23)
at Parser.parsePropertyDefinition (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11591:17)
at Parser.parseObjectLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11506:21)
at Parser.parseExprAtom (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11014:23)
at Parser.parseExprSubscripts (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10748:23)
at Parser.parseUpdate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10733:21)
at Parser.parseMaybeUnary (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10713:23)
at Parser.parseMaybeUnaryOrPrivate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10566:61)
at Parser.parseExprOps (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10571:23)
at Parser.parseMaybeConditional (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10548:23)
at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10511:21)
at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10537:25)
at Parser.parseExpressionBase (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10465:23)
at /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:39
at Parser.allowInAnd (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12085:16)
at Parser.parseExpression (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:17)
at Parser.parseStatementContent (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12529:23)
at Parser.parseStatementLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12396:17)
at Parser.parseModuleItem (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12373:17)
at Parser.parseBlockOrModuleBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12950:36)
at Parser.parseBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12943:10)
at Parser.parseProgram (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12270:10)
at Parser.parseTopLevel (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12260:25) {
code: 'BABEL_PARSE_ERROR',
reasonCode: 'UnexpectedReservedWord',
loc: Position { line: 3, column: 4, index: 63 },
pos: 63,
syntaxPlugin: undefined
}

Node.js v18.20.3

We can see this part of the error, showing the code that caused it:

Processing file 1/538
Processing: 100%
Processing file 2/538
/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360
const error = new SyntaxError();
^

SyntaxError: unknown: Unexpected reserved word 'await'. (3:4)

  1 | module.exports = {
  2 | showProjectGroupAccessDeniedModal() {
> 3 |   await swal.fire({
    |   ^
  4 |     icon: "error",
  5 |     title: "Access Denied",
  6 |     text: "You don't have the required permissions to access this project group.",

Putting the whole stack trace into ChatGPT 4o gave the following suggestion about the root cause of the error:

Yes, the stack trace does indicate an issue in your app code, even though the error originates from Babel. Specifically, the issue is:

SyntaxError: unknown: Unexpected reserved word 'await'. (3:4)

This points to the following section of your code:

  1 | module.exports = {
  2 | showProjectGroupAccessDeniedModal() {
> 3 | await swal.fire({
    | ^

What This Means:

  • The await keyword is used inside showProjectGroupAccessDeniedModal(), but the function is not declared as async.
  • Babel is failing while parsing your code because await can only be used inside an async function.

How to Fix:

Modify your function to be async:

module.exports = {
  async showProjectGroupAccessDeniedModal() {
    await swal.fire({
      icon: "error",
      title: "Access Denied",
      text: "You don't have the required permissions to access this project group.",
    });
  }
};

Why Babel is Involved:

Babel is responsible for parsing and transpiling your JavaScript, and it's throwing this error because the await keyword is misused. However, the actual problem is in your application code, not Babel itself.

So, fixing your function should resolve the issue. 🚀

<!-- gh-comment-id:2641827428 --> @0xdevalias commented on GitHub (Feb 7, 2025): > this seems to fix it: > > [main...fosteman:humanify:main](https://github.com/jehna/humanify/compare/main...fosteman:humanify:main) This seems to create a plugin that logs a `console.error`, and then skips the entire `Program`: ```ts const syntaxErrorPlugin: PluginItem = { visitor: { Program(path) { // Example: this would log an error and allow Babel to continue parsing console.error("Syntax error encountered. skipping", path); path.skip(); } } }; ``` Which is then added at the end of `transformWithPlugins`. @fosteman Can you explain how this fixes the issue? From my quick / naive read.. this looks like it would just skip running any processing against the code at all; so while yes, it would technically skip the issue, I believe it would also skip doing anything at all wouldn't it? Do you have a code sample where this issue was natively occurring? I would like someone to be able to provide a real-world sample so we can actually debug this issue properly and see exactly where/why it's occurring. --- **Edit:** Resurrecting the stack trace from your edit: <details><summary>Stack Trace</summary> ``` Processing file 1/538 Processing: 100% Processing file 2/538 /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360 const error = new SyntaxError(); ^ SyntaxError: unknown: Unexpected reserved word 'await'. (3:4) 1 | module.exports = { 2 | showProjectGroupAccessDeniedModal() { > 3 | await swal.fire({ | ^ 4 | icon: "error", 5 | title: "Access Denied", 6 | text: "You don't have the required permissions to access this project group.", at constructor (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360:19) at Parser.raise (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:3327:19) at Parser.checkReservedWord (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11899:12) at Parser.parseIdentifierName (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11879:12) at Parser.parseIdentifier (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11854:23) at Parser.parseExprAtom (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11090:27) at Parser.parseExprSubscripts (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10748:23) at Parser.parseUpdate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10733:21) at Parser.parseMaybeUnary (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10713:23) at Parser.parseMaybeUnaryOrPrivate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10566:61) at Parser.parseExprOps (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10571:23) at Parser.parseMaybeConditional (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10548:23) at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10511:21) at Parser.parseExpressionBase (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10465:23) at /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:39 at Parser.allowInAnd (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12085:16) at Parser.parseExpression (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:17) at Parser.parseStatementContent (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12529:23) at Parser.parseStatementLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12396:17) at Parser.parseStatementListItem (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12376:17) at Parser.parseBlockOrModuleBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12950:61) at Parser.parseBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12943:10) at Parser.parseBlock (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12931:10) at Parser.parseFunctionBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11773:24) at Parser.parseFunctionBodyAndFinish (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11759:10) at Parser.parseMethod (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11717:31) at Parser.parseObjectMethod (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11620:19) at Parser.parseObjPropValue (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11651:23) at Parser.parsePropertyDefinition (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11591:17) at Parser.parseObjectLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11506:21) at Parser.parseExprAtom (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:11014:23) at Parser.parseExprSubscripts (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10748:23) at Parser.parseUpdate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10733:21) at Parser.parseMaybeUnary (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10713:23) at Parser.parseMaybeUnaryOrPrivate (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10566:61) at Parser.parseExprOps (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10571:23) at Parser.parseMaybeConditional (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10548:23) at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10511:21) at Parser.parseMaybeAssign (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10537:25) at Parser.parseExpressionBase (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10465:23) at /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:39 at Parser.allowInAnd (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12085:16) at Parser.parseExpression (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:10461:17) at Parser.parseStatementContent (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12529:23) at Parser.parseStatementLike (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12396:17) at Parser.parseModuleItem (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12373:17) at Parser.parseBlockOrModuleBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12950:36) at Parser.parseBlockBody (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12943:10) at Parser.parseProgram (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12270:10) at Parser.parseTopLevel (/Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:12260:25) { code: 'BABEL_PARSE_ERROR', reasonCode: 'UnexpectedReservedWord', loc: Position { line: 3, column: 4, index: 63 }, pos: 63, syntaxPlugin: undefined } Node.js v18.20.3 ``` </details> We can see this part of the error, showing the code that caused it: ``` Processing file 1/538 Processing: 100% Processing file 2/538 /Users/REDACTED/.nvm/versions/node/v18.20.3/lib/node_modules/humanifyjs/node_modules/@babel/parser/lib/index.js:360 const error = new SyntaxError(); ^ SyntaxError: unknown: Unexpected reserved word 'await'. (3:4) 1 | module.exports = { 2 | showProjectGroupAccessDeniedModal() { > 3 | await swal.fire({ | ^ 4 | icon: "error", 5 | title: "Access Denied", 6 | text: "You don't have the required permissions to access this project group.", ``` Putting the whole stack trace into ChatGPT 4o gave the following suggestion about the root cause of the error: > Yes, the stack trace **does** indicate an issue in your app code, even though the error originates from Babel. Specifically, the issue is: > > ``` > SyntaxError: unknown: Unexpected reserved word 'await'. (3:4) > ``` > > This points to the following section of your code: > > ```js > 1 | module.exports = { > 2 | showProjectGroupAccessDeniedModal() { > > 3 | await swal.fire({ > | ^ > ``` > > ### What This Means: > > - The `await` keyword is used inside `showProjectGroupAccessDeniedModal()`, but the function is **not** declared as `async`. > - Babel is failing while parsing your code because `await` can only be used inside an `async` function. > > ### How to Fix: > > Modify your function to be `async`: > > ```js > module.exports = { > async showProjectGroupAccessDeniedModal() { > await swal.fire({ > icon: "error", > title: "Access Denied", > text: "You don't have the required permissions to access this project group.", > }); > } > }; > ``` > > ### Why Babel is Involved: > > Babel is responsible for parsing and transpiling your JavaScript, and it's throwing this error because the `await` keyword is misused. However, the **actual problem is in your application code**, not Babel itself. > > So, fixing your function should resolve the issue. 🚀
Author
Owner

@0xdevalias commented on GitHub (Feb 7, 2025):

@TheGreyRaven The surrounding context in your error is less clear than what I discovered above in https://github.com/jehna/humanify/issues/285#issuecomment-2641827428, but I suspect it's the same root cause, that there is an await keyword in your code, but the function isn't marked with async. If you still have the code sample available, are you able to check if that is true please?

SyntaxError: unknown: Unexpected reserved word 'await'. (638:6)

  636 |         return true;
  637 |       };
> 638 |       await _0x1f488e();
      |       ^
  639 |       clearInterval(_0x284d18);
  640 |       _0x284d18 = setInterval(_0x1f488e, 1000);
  641 |       $("#p_div_panel").show();

While I haven't yet explored this deeper, my potential guesses for areas to look deeper would be:

  • the original code sample never had the function marked with async before using await internally
  • perhaps during renaming of the outer function, humanify is removing the async keyword
  • perhaps during renaming of the inner function, humanify is choosing a name that includes async as a prefix (despite that being an invalid name)
<!-- gh-comment-id:2641845943 --> @0xdevalias commented on GitHub (Feb 7, 2025): @TheGreyRaven The surrounding context in your error is less clear than what I discovered above in https://github.com/jehna/humanify/issues/285#issuecomment-2641827428, but I suspect it's the same root cause, that there is an `await` keyword in your code, but the function isn't marked with `async`. If you still have the code sample available, are you able to check if that is true please? ``` SyntaxError: unknown: Unexpected reserved word 'await'. (638:6) 636 | return true; 637 | }; > 638 | await _0x1f488e(); | ^ 639 | clearInterval(_0x284d18); 640 | _0x284d18 = setInterval(_0x1f488e, 1000); 641 | $("#p_div_panel").show(); ``` --- While I haven't yet explored this deeper, my potential guesses for areas to look deeper would be: - the original code sample never had the function marked with `async` before using `await` internally - perhaps during renaming of the outer function, `humanify` is removing the `async` keyword - perhaps during renaming of the inner function, `humanify` is choosing a name that includes `async ` as a prefix (despite that being an invalid name)
Author
Owner

@j4k0xb commented on GitHub (Feb 15, 2025):

Ah I see, I tested pasting the obfuscated code into their online ide and there it deobuscated most of the code just fine.

Forgot to mention that it's configured to have laxer parsing rules (errorRecovery: true), which also allows await in non-async functions.

And thanks to @0xdevalias I found the root cause why your fork got rid of the error: the bug is in babel-plugin-transform-beautifier, which removes the async keyword.
There are also many similar transforms that exist in humanify, webcrack and this plugin at the same time, might be a good idea to review which ones are needed.

<!-- gh-comment-id:2660751350 --> @j4k0xb commented on GitHub (Feb 15, 2025): > Ah I see, I tested pasting the obfuscated code into their online ide and there it deobuscated most of the code just fine. Forgot to mention that it's configured to have laxer parsing rules (`errorRecovery: true`), which also allows await in non-async functions. And thanks to @0xdevalias I found the root cause why your fork got rid of the error: the bug is in `babel-plugin-transform-beautifier`, which removes the async keyword. There are also many similar transforms that exist in humanify, webcrack and this plugin at the same time, might be a good idea to review which ones are needed.
Author
Owner

@0xdevalias commented on GitHub (Feb 16, 2025):

Imported here:

github.com/jehna/humanify@88b51bc689/src/plugins/babel/babel.ts (L4-L4)

Used here:

github.com/jehna/humanify@88b51bc689/src/plugins/babel/babel.ts (L72-L78)

I found the root cause why your fork got rid of the error: the bug is in babel-plugin-transform-beautifier, which removes the async keyword.

Upstream bug issue:

There are also many similar transforms that exist in humanify, webcrack and this plugin at the same time, might be a good idea to review which ones are needed.

@jehna Is there any reason we need to keep babel-plugin-transform-beautifier in humanify at all? I've generally found that webcrack / wakaru (#3) do a pretty good job of beautifying the code; and if there are any edge cases where it could be better; my personal thought would be that upstreaming those (if relevant) might make more sense than trying to fix them here after the fact.

The other internal plugins defined here:

<!-- gh-comment-id:2661322785 --> @0xdevalias commented on GitHub (Feb 16, 2025): Imported here: https://github.com/jehna/humanify/blob/88b51bc689d23717212b035eb287a0d3c07d3f1b/src/plugins/babel/babel.ts#L4-L4 Used here: https://github.com/jehna/humanify/blob/88b51bc689d23717212b035eb287a0d3c07d3f1b/src/plugins/babel/babel.ts#L72-L78 > I found the root cause why your fork got rid of the error: the bug is in `babel-plugin-transform-beautifier`, which removes the async keyword. Upstream bug issue: - https://github.com/gzzhanghao/babel-plugin-transform-beautifier/issues/3 > There are also many similar transforms that exist in humanify, webcrack and this plugin at the same time, might be a good idea to review which ones are needed. @jehna Is there any reason we need to keep `babel-plugin-transform-beautifier` in `humanify` at all? I've generally found that `webcrack` / `wakaru` (#3) do a pretty good job of beautifying the code; and if there are any edge cases where it could be better; my personal thought would be that upstreaming those (if relevant) might make more sense than trying to fix them here after the fact. The other internal plugins defined here: - `convertVoidToUndefined` - https://github.com/jehna/humanify/blob/88b51bc689d23717212b035eb287a0d3c07d3f1b/src/plugins/babel/babel.ts#L6-L21 - From a very naive/quick skim, these might be related functionality in `webcrack`: - https://github.com/j4k0xb/webcrack/blob/302bd93e995d4396f8cde24c69da3ad0899b2bd3/packages/webcrack/src/unminify/transforms/void-to-undefined.ts - https://github.com/j4k0xb/webcrack/blob/302bd93e995d4396f8cde24c69da3ad0899b2bd3/packages/webcrack/src/unminify/test/void-to-undefined.test.ts - `flipComparisonsTheRightWayAround` - https://github.com/jehna/humanify/blob/88b51bc689d23717212b035eb287a0d3c07d3f1b/src/plugins/babel/babel.ts#L23-L53 - From a very naive/quick skim, these might be related functionality in `webcrack`: - https://github.com/j4k0xb/webcrack/blob/302bd93e995d4396f8cde24c69da3ad0899b2bd3/packages/webcrack/src/unminify/transforms/invert-boolean-logic.ts - https://github.com/j4k0xb/webcrack/blob/302bd93e995d4396f8cde24c69da3ad0899b2bd3/packages/webcrack/src/unminify/transforms/yoda.ts - `makeNumbersLonger` - https://github.com/jehna/humanify/blob/88b51bc689d23717212b035eb287a0d3c07d3f1b/src/plugins/babel/babel.ts#L55-L70 - From a very naive/quick skim, I didn't find any related functionality in `webcrack`
Author
Owner

@j4k0xb commented on GitHub (Feb 16, 2025):

<!-- gh-comment-id:2661478873 --> @j4k0xb commented on GitHub (Feb 16, 2025): - makeNumbersLonger: https://github.com/j4k0xb/webcrack/blob/302bd93e995d4396f8cde24c69da3ad0899b2bd3/packages/webcrack/src/unminify/transforms/raw-literals.ts#L13-L18 normalizes any number formatting like 5e3 or 0x2b20
Author
Owner
<!-- gh-comment-id:2661687303 --> @0xdevalias commented on GitHub (Feb 16, 2025): > Upstream bug issue: > > - https://github.com/gzzhanghao/babel-plugin-transform-beautifier/issues/3 > Fixed in v0.1.1 > > _Originally posted by @gzzhanghao in https://github.com/gzzhanghao/babel-plugin-transform-beautifier/issues/3#issuecomment-2661448752_ - https://github.com/gzzhanghao/babel-plugin-transform-beautifier/pull/5 - https://github.com/gzzhanghao/babel-plugin-transform-beautifier/blob/main/CHANGELOG.md#011 - https://www.npmjs.com/package/babel-plugin-transform-beautifier/v/0.1.1 **Edit:** PR to bump the dependency: - https://github.com/jehna/humanify/pull/324
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/humanify#66
No description provided.