Dynamo db type conversion error ValidationException: A value provided cannot be converted into a number

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Dynamo db type conversion error ValidationException: A value provided cannot be converted into a number



I have a dynamo DB query like this. Which I execute to add data to two different table and this question is the continuation of the first question. Using batchWriteItem in dynamodb


var createuser =
"RequestItems":
"users": [

"PutRequest":
Item:
"userid": "N": "usrid" ,
"role": "S": 'candidate' ,
"password": "S": vucrypt.encryptpass(pass)



],
"candidate": [

"PutRequest":
Item:
"fname":
"S": req.body.fname
,
"lname":
"S": req.body.lname
,
"location":
"S": req.body.location
,
"phone":
"S": req.body.phone
,
"ccode":
"S": req.body.ccode
,
"grad":
"S": req.body.grad
,
"pgrad":
"S": req.body.pgrad
,
"ograd":
"S": req.body.ograd
,
"experience":
"N": "10"
,
"linkedin":
"S": req.body.linkedin
,
"terms":
"S": tandc




]




When i excicute this code i am getting an error like this.


ValidationException: A value provided cannot be converted into a number



I tried with this.


var exps = Number(exp);



But still, this error persist what can I do? any idea?



My code is like this.


dynamodb.batchWriteItem(createuser, function(err, regdata) );




1 Answer
1



All the values must be strings:



for example :


"fname":
"S": req.body.fname



req.body.fname must be a string



so just add


req.body.fname + ""



OR



req.body.fname.toString();





THis is not working i am keep getting this error ValidationException: A value provided cannot be converted into a number
– Arun VM
Aug 6 at 10:31


ValidationException: A value provided cannot be converted into a number





can you show your code
– Temkit Sidali
Aug 6 at 10:32






I have edited the question
– Arun VM
Aug 6 at 10:36





your error is here "userid": "N": "usrid" , delete the quotes from the userid. and cast the userid to string : "userid": "N": usrid + ""
– Temkit Sidali
Aug 6 at 10:39






still no hope :(
– Arun VM
Aug 6 at 10:51






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard