ruimarinho / gsts

Obtain and store AWS STS credentials to interact with Amazon services by authenticating via G Suite SAML.
MIT License
219 stars 38 forks source link

Error on node 8.11.4 #19

Closed dmmartins closed 4 years ago

dmmartins commented 4 years ago

When I run gsts on node 8.11.4 I get the follow error

% gsts
/Users/diego/.nvm/versions/node/v8.11.4/lib/node_modules/gsts/parser.js:11
const REGEX_PATTERN_ROLE = /(?<roleArn>arn:(aws|aws-us-gov|aws-cn):iam:[^:]*:[0-9]+:role\/(?<name>[^,]+))/i;
                           ^

SyntaxError: Invalid regular expression: /(?<roleArn>arn:(aws|aws-us-gov|aws-cn):iam:[^:]*:[0-9]+:role\/(?<name>[^,]+))/: Invalid group
    at Object.<anonymous> (/Users/diego/.nvm/versions/node/v8.11.4/lib/node_modules/gsts/parser.js:11:28)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/diego/.nvm/versions/node/v8.11.4/lib/node_modules/gsts/credentials-manager.js:7:16)
    at Module._compile (module.js:652:30)

nodejs prior to version 10 doesn't support named regex capture. I understand node 8 is pretty old and you may not be interested in keep the compatibility.

ruimarinho commented 4 years ago

@dmmartins if this is the only required change to make it node 8 compatible, sure. Can you do some digging? Cheers.