1 Answer
- Newest
- Most votes
- Most comments
0
Found the error. We were using the event["request"]
values for some internal logic in a separate function and that was modifying the values (forgot that dictionaries are passed by reference since they are mutable). Solved this by making a deep copy (using copy.deepcopy(event["request"])
) before passing it on to the function.
Basically looks like the following
from copy import deepcopy def function_handler(event, context): # create a deep copy of the event request request = deepcopy(event['request']) # do something in our custom function, for us it returns a boolean response = do_something(request) if not response: # since our function did not work as expected, we cannot create the user, raising an exception raise Exception('do_something failed, here is an error message that makes sense...') # since do_something worked, let's confirm the user event['response']['autoConfirmUser'] = True event['response']['autoVerifyEmail'] = True return event
This worked. In retrospect, the error Unrecognizable lambda output
is not really helpful, if it had more information on the request
being modified it would have taken us much less time to figure this out.
answered a year ago
Relevant content
- AWS OFFICIALUpdated a year ago
I followed this up by splitting my presign up lambda to just do auto confirm user and verify the email, the rest of the logic (which creates some user related stuff in our backend via an internal POST call) is in the post confirmation lambda.
The user is getting created, the post confirmation lambda is running... BUT I still get the error. This is very frustrating, given the lack of documentation by AWS.