You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't cloned this repository, so maybe there's just something different from your code and mine that I'm missing, but when I use context.succeed for the create operation, it shows the postId in Postman, but it doesn't actually create the db entry.
I set theAdministratorAccess policy to the IAM user.
And also modified the s-resources-cf.json: add resources permission to access dynamodb.
It would very helpful if you could tell me what's wrong with my codes,
or let us see how it worked on your project.
I've stuck by this issue for whole day.
If I were missing permissions, it would return an error instead of just not doing anything. Everything works fine with context.done, just not with context.succeed.
context.succeed will be executed in line and return a result to the second argument.
You can check this link to understand the callback style in JavaScript.
Or you can just give a try, you will be suprised that it works.
Btw, you should put some permission into the s-resources-cf.json.
I've created a similar example, you can check my repo, too
Activity
deryl27 commentedon May 17, 2016
Even I am facing this issue
luctus commentedon May 19, 2016
It worked for me. Did you set the permissions to dynamodb?
abalone0204 commentedon May 20, 2016
@luctus I've faced the same problem.
I set the
AdministratorAccesspolicy to the IAM user.And also modified the
s-resources-cf.json: add resources permission to access dynamodb.It would very helpful if you could tell me what's wrong with my codes,
or let us see how it worked on your project.
I've stuck by this issue for whole day.
btw, I've posted a question on stackoverflow
AlexMcConnell commentedon May 20, 2016
If I were missing permissions, it would return an error instead of just not doing anything. Everything works fine with context.done, just not with context.succeed.
abalone0204 commentedon May 20, 2016
@AlexMcConnell !
I just figure it out!
In the second arguments of the putItem, it should be a callback function,
but in the example:
It's executed inline..
So if we change this into
The
context.succeedwill be executed after theputItembe done.:D Hope this may helpful to you!
luctus commentedon May 20, 2016
@abalone0204 I'm kind of new to node, but I was pretty sure that there is no difference between
and
Am I wrong?
abalone0204 commentedon May 21, 2016
No, they are absolutely different.
It's a function declaration in the second argument,
it will wait for the
putItemdone then call this function.As for this:
context.succeedwill be executed in line and return a result to the second argument.You can check this link to understand the callback style in JavaScript.
Or you can just give a try, you will be suprised that it works.
Btw, you should put some permission into the
s-resources-cf.json.I've created a similar example, you can check my repo, too