-
Notifications
You must be signed in to change notification settings - Fork 18
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
Unhandled rejection MultipleValidationErrors - running in a serverless-local environment #61
Comments
Did you ever solve this? Same error. There's so much outdated junk on AWS/Serverless that it's hard to get anything working from examples. |
+1 |
After doing some digging, this appears to be caused by an Line 74 of param_validator.js in aws-dsk lib is where this happens. if (memberShape !== undefined) {
var memberContext = [context, paramName].join('.');
this.validateMember(memberShape, paramValue, memberContext);
} else {
this.fail('UnexpectedParameter',
'Unexpected key \'' + paramName + '\' found in ' + context);
} Not really sure if there's a solution beyond scrubbing record input, but it is weird that validation misses on the first run for some reason. |
+1 When attempting to insert into DynamoDB my aws-sdk complains that my formatting is not correct:
From what I can see this is related to aws-sdk not being passed the type etc, re: this stackoverflow answer: https://stackoverflow.com/questions/33942945/error-invalidparametertype-expected-params-itempid-to-be-a-structure-in-dyn That being the case essentially the answer recommends using the AWS.DynamoDB.DocumentClient which lets you avoid specifying the type of data you are attempting to insert since it automatically marshals Javascript types onto DynamoDB AttributeValues. More on the document client here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html Given the above it seems like the issue likely has to do with the item type either not being declared properly going from npd to aws-sdk.dynamodb or alternately not being declared at all (ie. InvalidParameterType: Expected params.Item['lastUpdated'] to be a structure gets thrown since there is no type property). @alphaadidas, @JamesTheHacker, @matttowerssonos, @rudeluv did you guys ever get this working? |
@necevil I just started checking for |
When using
npdynamodb
with a serverless application and dynamodb-local, validation errors are thrown for every database access call after the first one.I'm working on a serverless application that uses
npdynamodb
ORM for accessing DynamoDB tables in a Lambda context. To facilitate testing, I'm using the serverless framework with theserverless-local
andserverless-dynamodb-local
plugins to run a local instance of DynamoDB. In that environment, in order to simulate a Lambda runtime context,serverless
reloads the Lambda modules between each request.When using
npdynamodb
in this environment, the first database request executed in the process succeeds as expected. However, all subsequent requests throw the following error:As best I can tell, there is some sort of module-level caching going on that is preventing
npdynamodb
from cleanly reloading.The following code simulates what
serverless
is doing as part of its module reloading and will reproduce the error withnpdynamodb
. (Code assumesdynamodb-local
is running and tableusers
has been defined.Output:
The text was updated successfully, but these errors were encountered: