Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: childComponentInstance.init is not a function #21

Open
Arditc opened this issue Dec 4, 2020 · 5 comments
Open

TypeError: childComponentInstance.init is not a function #21

Arditc opened this issue Dec 4, 2020 · 5 comments

Comments

@Arditc
Copy link

Arditc commented Dec 4, 2020

Hi, I'm trying to add a database (dynamodb) into my serverless file, however I get this error:

 error:
  TypeError: childComponentInstance.init is not a function
    at Template.load (/usr/local/lib/node_modules/serverless/node_modules/@serverless/core/src/Component.js:116:34)
    at async fn (/usr/local/lib/node_modules/serverless/node_modules/@serverless/template/utils.js:272:25)
    at async Promise.all (index 1)
    at async executeGraph (/usr/local/lib/node_modules/serverless/node_modules/@serverless/template/utils.js:294:3)
    at async Template.default (/usr/local/lib/node_modules/serverless/node_modules/@serverless/template/serverless.js:67:38)
    at async Object.runComponents (/usr/local/lib/node_modules/serverless/node_modules/@serverless/cli/src/index.js:220:17)

  47s › Template › TypeError: childComponentInstance.init is not a function

Do you have any ideas on how I can add a dynamodb table via serverless?

I've used @serverless/aws-dynamodb and that works fine, however I wanted to use the latest serverless component.

Here are some details regarding my serverless versions:

serverless --version

Framework Core: 1.74.1
Plugin: 3.6.15
SDK: 2.3.1
Components: 2.31.10

Serverless file:

App:
  component: "@sls-next/serverless-component@1.18.0"
  inputs:
    roleArn: xxxx
    domain: "xxxxx" # sub-domain defaults to www
    cloudfront:
      distributionId: xxxxx
      defaults:
        forward:
          cookies: "none"

database:
  component: aws-dynamodb          # (required) name of the component. In that case, it's aws-dynamodb.
  name: app-db                   # (required) name of your instance.

  inputs:
    name: app-db
    attributeDefinitions:
      - AttributeName: id
        AttributeType: S
      - AttributeName: attribute1
        AttributeType: N
    keySchema:
      - AttributeName: id
        KeyType: HASH
      - AttributeName: attribute1
        KeyType: RANGE
    localSecondaryIndexes:
      - IndexName: 'myLocalSecondaryIndex'
        KeySchema:
          - AttributeName: id
            KeyType: HASH
          - AttributeName: attribute2
            KeyType: RANGE
        Projection:
          ProjectionType: 'KEYS_ONLY'
    globalSecondaryIndexes:
      - IndexName: 'myGlobalSecondaryIndex'
        KeySchema:
          - AttributeName: attribute2
            KeyType: HASH
        Projection:
          ProjectionType: 'ALL'
    region: us-east-1

Many thanks :)

@amanvir
Copy link

amanvir commented Dec 7, 2020

Also running into the same issue, haven't had a chance to investigate, has anybody else taken a look?

@techexe-code
Copy link

also I am getting same error

@lracicot
Copy link

Same issue here.

@Geoff-Ford
Copy link

Did you get anywhere with this? I have the same issue still in 2022!

@williamrjribeiro
Copy link

@Geoff-Ford What solved this issue for me was using the name of the latest version of the component: "@serverless/aws-dynamodb"

If aws-dynamodb is used, I think it installs a very old version which is not compatible with components-v1 command. I hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants