shiftcode/dynamo-easy

TypeError: Reflect.getMetadata is not a function

charlieporth1 opened this issue · 2 comments

Describe the bug
When installing prod only using npm install --only=prod when installed on AWS lambda

The stack trace is

{
    "errorType": "TypeError",
    "errorMessage": "Reflect.getMetadata is not a function",
    "stack": [
        "TypeError: Reflect.getMetadata is not a function",
        "    at /opt/node_modules/@shiftcoders/dynamo-easy/dist/decorator/impl/key/partition-key.decorator.js:14:40",
        "    at __decorate (/var/task/models/model.js:5:110)",
        "    at Object.<anonymous> (/var/task/models/model.js:17:1)",
        "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
        "    at Module.require (internal/modules/cjs/loader.js:887:19)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at Object.<anonymous> (/var/task/models/user.entity.js:12:17)"
    ]
}

Expected behavior
For it to work?

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 11
  • Browser Chrome
  • Version Version 89.0.4389.9 (Official Build) dev (x86_64)

Additional context
N/A

Gi60s commented

For anyone who follows the installation instructions and still has problems, put the import "reflect-metadata" at the top of your imports, not the bottom. I can't believe I banged my head against that one for so long. "Duh" moment.