nervous-systems / cljs-lambda

Utilities around deploying Clojurescript functions to AWS Lambda
The Unlicense
311 stars 34 forks source link

Weird Response In Lambda Console #106

Closed JimLynchCodes closed 6 years ago

JimLynchCodes commented 6 years ago

Hi, I'm getting very odd-looking responses in the AWS Lambda console.

I can see things happening in the cloudwatch logs so I know this bit of code is being executed:

(ctx/succeed! ctx "Derp")

But it seems like I can't send a string, mmap, js object...

In the AWS console my response always looks like this:

"tail": 0,
"length": 0,
"arr": [
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null,
  null
]

}, "dirty_takes": 0, "puts": { "head": 0, "tail": 0, "length": 0, "arr": [ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ] }, "dirty_puts": 0, "buf": { "buf": { "head": 0, "tail": 0, "length": 0, "arr": [ null ] }, "n": 1, "cljs$lang$protocol_mask$partition0$": 2, "cljs$lang$protocol_mask$partition1$": 0 }, "closed": false }

JimLynchCodes commented 6 years ago

If you can, please check this project which is basically all contained in this one file: https://github.com/JimTheMan/Cljs-Twitter-Unfollower/blob/master/twitter-unfollower/src/twitter_unfollower/core.cljs

moea commented 6 years ago

@JimTheMan sorry for the late response. The channel returned by your lambda function has a channel on it, because you aren't taking (w/ <!) from the result of the call to unfollowUser. The data structure in your issue is the JSON representation of a core.async channel.

JimLynchCodes commented 6 years ago

Thanks Moe! I figured it was trying to log the channel itself. I'm still not totally understanding why the unfollowUser function returns a channel, but you are right that with a "<!" here it works! thanks again. :)