-
Notifications
You must be signed in to change notification settings - Fork 598
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
DynamoDB - Cannot read property '0' of undefined #2117
Comments
I figured it out, the query "ExpressionAttributeValues" were not formatted properly. Maybe we should adjust the typing in typescript to flag this as an error? The correct way is: note the { S: parsedBody.myColumn }
|
Hey @antawad, thanks for opening this issue, I believe its more of a client side usage mistake as when using The |
I had the same issue as @antawad and the |
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Describe the bug
The @aws-sdk/client-dynamodb is throwing an ambiguous error 'Cannot read property '0' of undefined' . I am using sdk v3.8.0. It was working great with the previous sdk using DocumentClient instead.
Your environment
SDK version number
@aws-sdk/client-dynamodb@3.8.0
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
Paste output of
npx envinfo --browsers
ornode -v
orreact-native -v
v14.15.4
Steps to reproduce
Run the following command to start local debugging:
sam local start-api -d 9999
Create a simple dynamo db table and a secondary index.
Create a lambda function with the following code:
The table is already created and the index as well. The previous version of the sdk worked fine.
Observed behavior
A clear and concise description of what happens.
An ambiguous error is thrown.
Invalid lambda response received: Invalid API Gateway Response Keys: {'errorType', 'trace', 'errorMessage'} in {'errorType': 'TypeError', 'errorMessage': "Cannot read property '0' of undefined", 'trace': ["TypeError: Cannot read property '0' of undefined", ' at Object.visit (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/models/models_0.js:1101:40)', ' at serializeAws_json1_0AttributeValue (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/protocols/Aws_json1_0.js:4612:38)', ' at /var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/protocols/Aws_json1_0.js:5074:20', ' at Array.reduce (<anonymous>)', ' at serializeAws_json1_0ExpressionAttributeValueMap (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/protocols/Aws_json1_0.js:5068:34)', ' at serializeAws_json1_0QueryInput (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/protocols/Aws_json1_0.js:5544:40)', ' at Object.serializeAws_json1_0QueryCommand (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/protocols/Aws_json1_0.js:354:27)', ' at serialize (/var/task/node_modules/@aws-sdk/client-dynamodb/dist/cjs/commands/QueryCommand.js:95:30)', ' at /var/task/node_modules/@aws-sdk/middleware-serde/dist/cjs/serializerMiddleware.js:5:27', ' at /var/task/node_modules/@aws-sdk/middleware-logger/dist/cjs/loggerMiddleware.js:6:28']}
Expected behavior
Expected the records to be returned.
Screenshots
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: