99x / serverless-dynamodb-local

Serverless Dynamodb Local Plugin - Allows to run dynamodb locally for serverless
MIT License
625 stars 233 forks source link

Unable to seed online database #247

Open Lakshamana opened 4 years ago

Lakshamana commented 4 years ago

Actual Behaviour

I'm not currently able to seed my online DynamoDB tables. Below I paste my dynamodb local config (at serverless.yml):

...
dynamodb:
    stages:
      - dev
    start:
      port: 8000
      inMemory: true
      heapInitial: 200m
      heapMax: 1g
      migrate: true
      seed: true

    seed:
      domain:
        sources:
          - table: Users
            sources: [./.fixtures/users.json]
          - table: BudgetHistory
            sources: [./.fixtures/budgetHistory.json]
          - table: PartnerOffices
            sources: [./.fixtures/partnerOffices.json]
...

Please, let me know if I should paste db schema resources here and please consider that my local dynamo instance work like a charm (it's just online throwing this error).

Expected Behaviour

I expected to seed my dynamo online instance. i.e, I suppose I could see the just seeded db on AWS Console

Steps to reproduce it

  1. I first created local seeds files as .json so I reference them in serverless.yml under custom variables.
  2. Deploy with sls with sls deploy
  3. Run sls dynamodb seed --online --region sa-east-1
  4. See the error and cry

LogCat for the issue Here is my log:

> sls dynamodb seed --online --region sa-east-1

Serverless: Connecting to online tables...

  Resource Not Found Exception ---------------------------

  ResourceNotFoundException: Requested resource not found
      at Request.extractError (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/protocol/json.js:51:27)
      at Request.callListeners (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
      at Request.emit (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.<anonymous> (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.<anonymous> (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at Request.emit (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.<anonymous> (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.<anonymous> (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at callNextListener (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
      at IncomingMessage.onEnd (/home/arjuna/git/preco-de-cartorio/node_modules/aws-sdk/lib/event_listeners.js:307:13)
      at IncomingMessage.emit (events.js:328:22)
      at IncomingMessage.EventEmitter.emit (domain.js:485:12)
      at endReadableNT (_stream_readable.js:1201:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              13.10.1
     Framework Version:         1.61.2
     Plugin Version:            3.2.7
     SDK Version:               2.2.1
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! preco-de-cartorio@1.0.0 seed:deploy: `sls dynamodb seed --online --region sa-east-1`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the preco-de-cartorio@1.0.0 seed:deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/arjuna/.npm/_logs/2020-03-25T17_40_51_804Z-debug.log

Screenshots of the issue

image

Would you like to work on the issue? I do not feel able to start digging the holes toward solving this issue, since I'm not this repo contributor nor have knowledge of how do things work. I've looked for issues like this one #198. Neverthless I couldn't figure out which could be a reasonable solution. Any ideas?

okamuuu commented 4 years ago

Hi, I was facing the same situation.

Try this code:)

AWS_PROFILE=YOUR-AWS_PROFILE sls dynamodb seed --online --region your-region