TypeError: Cannot read properties of undefined (reading '0')
Closed this issue · 2 comments
juztinlazaro commented
yarn sls dynamodb seed --seed=test
yarn run v1.22.21
$ C:\repos\service-document-collection\node_modules\.bin\sls dynamodb seed --seed=test
serverless-offline-ssm checking serverless version 3.38.0.
Warning: Invalid configuration encountered
at 'provider': unrecognized property 'cloudfrontLeadingPath'
Learn more about configuration validation here: http://slss.io/configuration-validation
Seed running complete for table: tableContacts
Seed running complete for table: tableInvites
Seed running complete for table: tableUserGroups
Seed running complete for table: tableUsers
3 deprecations found: run 'serverless doctor' for more details
× Uncaught exception
C:\repos\service-document-collection\node_modules\serverless\scripts\serverless.js:52
throw error;
^
TypeError: Cannot read properties of undefined (reading '0')
at Object.visit (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:983:36)
at se_AttributeValue (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2455:25)
at C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2834:16
at Array.reduce (<anonymous>)
at se_PutItemInputAttributeMap (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2830:32)
at Item (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2840:18)
at applyInstruction (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1088:27)
at take (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1056:5)
at se_PutRequest (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2839:40)
at PutRequest (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:3033:24)
at applyInstruction (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1088:27)
at take (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1056:5)
at se_WriteRequest (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:3031:40)
at C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:3038:12
at Array.map (<anonymous>)
at se_WriteRequests (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:3037:41)
at C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2544:16
at Array.reduce (<anonymous>)
at se_BatchWriteItemRequestMap (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2540:32)
at RequestItems (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2534:26)
at applyInstruction (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1088:27)
at take (C:\repos\service-document-collection\node_modules\@smithy\smithy-client\dist-cjs\index.js:1056:5)
at se_BatchWriteItemInput (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:2533:40) at se_BatchWriteItemCommand (C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\dist-cjs\index.js:1040:25)
at C:\repos\service-document-collection\node_modules\@smithy\middleware-serde\dist-cjs\index.js:59:25
at C:\repos\service-document-collection\node_modules\@smithy\middleware-endpoint\dist-cjs\index.js:199:12
at async C:\repos\service-document-collection\node_modules\@aws-sdk\client-dynamodb\node_modules\@aws-sdk\middleware-logger\dist-cjs\index.js:33:22
at async Timeout._onTimeout (C:\repos\service-document-collection\node_modules\serverless-dynamodb\dist\seeder.js:33:21)
Node.js v18.19.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
serverless-dynamodb:
# If you only want to use DynamoDB Local in some stages, declare them here
stages:
- docker
- loc
start:
port: 8000
inMemory: true
heapInitial: 200m
heapMax: 1g
migrate: true
seed: true
convertEmptyValues: true
# Uncomment only if you already have a DynamoDB running locally
# noStart: true
seed:
test:
sources:
- table: tableContacts
rawsources: [./config/migrations/contacts-table.json]
- table: tableInvites
rawsources: [./config/migrations/invites-table.json]
- table: tableUserGroups
rawsources: [./config/migrations/userGroups-table.json]
- table: tableUsers
rawsources: [./config/migrations/users-table.json]
domdomegg commented
Could you provide an example of what you're providing for rawsources e.g. what's the contents of ./config/migrations/contacts-table.json
? Or ideally an MRE? Also if this was previously working on an older version, can you let me know which version this was working on?
I am unable to reproduce this error. I think this might be a misconfiguration - you might want to use sources
instead of rawsources
.
The error messaging is not great here though - that definitely could be improved.