-
Notifications
You must be signed in to change notification settings - Fork 121
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'statusCode' of undefined #9
Comments
Instead of running |
|
It has all the symptoms of a callback being called twice, once with the correct parameters, and the second with no parameters. Not able to track it down, though. |
I am facing the same issue. How did you solve it? |
@franva it was nearly a year ago, so I can't remember the specifics, but I believe I had my netlify lambda folder set up wrong, or was skipping a step. I wrote up what I did to finally get it working here: https://www.freecodecamp.org/news/netlify-functions-firebase-and-graphql-working-together-at-last/ |
Hi, thanks for this great little example, it helped me get started quickly and get better understanding of how to use Netlify's implementation of Lambda.
Something I wanted to share as well is I've set up the secret in
.env
and addedexport $(cat .env | xargs) &&
to the start script which is handy for local dev.As to the error - I find that if you unwrap your lambda functions return responses from the callback objects the error is fixed:
console.log('error', error) return { statusCode: 200, body: JSON.stringify(ret) }
I thought sharing this might help someone bootstrap this project. Thanks!
The text was updated successfully, but these errors were encountered: