The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

btgrant (4) [Avatar] Offline
#1
Towards the end of the "Understanding IAM Permissions" video, when I am running the deployed code, I'm getting an error from the AWS SDK's ParameterValidator; the meaningful part of the message is:

  message: 'Expected params.Body to be a string, Buffer, Stream, Blob, or typed array object',
  code: 'InvalidParameterType'


I added some console logging in resizer.js in both getS3Object and putS3Object the logging on putS3Object occurs just before the error. I have otherwise copied/pasted the code from the GitHub project so, as far as I can tell, it isn't an issue with something I've mistyped.

Thanks for the help! Really enjoying the content so far!
Brian
479219 (4) [Avatar] Offline
#2
Hello can you share with me the code that you are running (upload it to github and share the link) and also the exact line where you get this error?

Cheers,
Marcia
btgrant (4) [Avatar] Offline
#3
479219 wrote:Hello can you share with me the code that you are running (upload it to github and share the link) and also the exact line where you get this error?

Cheers,
Marcia


I pushed my code to Github. I experienced this issue with both "master" and "with-additional-logging" branches. As best as I can tell, the error results from line 28 of resizer.js because I can see the log statement from line 26 before the error occurs. It's also an AWS that is producing the error relating to params.Body.

Hopefully that's what you were looking for! I'm a relatively inexperienced JavaScript developer and this series is literally the first time I've done anything with Node!

Thanks again,
Brian

btgrant (4) [Avatar] Offline
#4
I took another look at it and cloned your repo and used the 3_2_basic_operations branch with my serverless.yml; that worked. But when I copy/paste the code from your repo in to mine, that doesn't work. Maybe there's something messed up with my project. I'll start a new one from scratch and see if it works. As I said, I don't know Node and maybe I messed something up along the way.
479219 (4) [Avatar] Offline
#5
Ok, let me know how it goes.
If not put the code in github. where the error is and what the error is. and I can check it out
btgrant (4) [Avatar] Offline
#6
I got some help with troubleshooting my broken project from a coworker who has a lot more experience with Node. Though the .js files between the two projects were the same, the package.json "dependencies" list was quite different. Yours only lists
  "dependencies": {
    "jimp": "^0.2.28"
  }


while mine lists
  "dependencies": {
    "jimp": "^0.6.0",
    "serverless": "^1.35.1"
  }


When I remove the "serverless" dependency from mine, the project works as expected. I'm not sure how that got in there -- maybe something I did incorrectly when setting up the project.

It's also worth noting that, when I run sls --version, the output is 1.33.2.