0

I'm getting this error after installing an AWS package(@aws-sdk/client-dynamodb) into my typescript project

js\node_modules\@aws-sdk\client-dynamodb\dist-cjs\protocols\Aws_json1_0.js:3541
        ClientRequestToken: input.ClientRequestToken ?? (0, uuid_1.v4)(),
                                                      ^

SyntaxError: Unexpected token ?

This is the set up for my project.(tsconfig.ts) `

{
    "compilerOptions": {
        "outDir": "./dist/",        // path to output directory
        "sourceMap": true,          // allow sourcemap support
        "strictNullChecks": true,   // enable strict null checks as a best practice
        "module": "commonjs",       // specify module code generation
        "allowJs": true,            // allow a partial TypeScript and JavaScript codebase
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "baseUrl": ".",
        "paths": {
            "@config/*": ["config/*"],
            "@common/*": ["test/common/*"],
            "@models/*": ["test/models/*"]
        }
    },
    "include": [
        "./"
    ]
}

`

This is my package.json

"dependencies": {
  "@aws-sdk/client-dynamodb": "^3.218.0",
  "@aws-sdk/lib-dynamodb": "^3.218.0",
"ts-node": "^8.10.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^3.8.3"
}

tried changing the typescript version

Overall goal is to have the typescript error away

Francis Ade
  • 328
  • 3
  • 8
  • Set your target to a lower version of JS for your compiler output. – Jared Smith Nov 30 '22 at 20:02
  • 1
    What version of node/npm are you on? – Andy Nov 30 '22 at 20:03
  • node: 10.15 npm: 6.4.1 – Francis Ade Dec 01 '22 at 12:02
  • @JaredSmith i tried setting the target to es5. same error – Francis Ade Dec 01 '22 at 12:11
  • @FrancisAde node 10 hit end of life *five years ago* (April of 2018). Upgrade to a newer version of node. That will *probably* fix your problem, at least your immediate one. – Jared Smith Dec 01 '22 at 13:32
  • But longer term... well, you can run with old versions of things as long as you don't mind the gaping security holes. But as soon as you try to add a new dependency it isn't going to work with all of your ancient packages/runtime. You will need to budget in maintenance time to periodically upgrade your environment and dependencies. It sucks to have to do that when a system has been running without problems, and in a perfect world people would be less cavalier about breaking things and you wouldn't need to, but that's not the world we live in. This is what happens when you don't. – Jared Smith Dec 01 '22 at 13:38
  • Also correction: node 10 came out 4/2018. It was EOL'd 2 years ago. Still. – Jared Smith Dec 01 '22 at 13:43

0 Answers0