I may have found a little buggy issue with sst and...
# sst
l
I may have found a little buggy issue with sst and Python lambdas: • I have a Lambda, called
KAR_ROT_complete_performance.py
, which puts a
PerformanceCompleted
event on my event bus. Works great, works great, returns a result with
"FailedEntryCount": 0
- all good. • Then, I have a Lambda, called
KAR_HST_add_performance.py
, that consumes said event and places it in a performance history dynamodb table. • If I do a
npx sst deploy --stage test
and then POST to the API to complete a performance, everything works great. No errors in the CloudWatch logs, and I can see my performance in the performance table. So, it works end-to-end with a
deploy
. • If I do a
npx sst start --stage test
, my
KAR_ROT_complete_performance.py
still works well, but my
KAR_HST_add_performance.py
throws the following exception in the terminal:
Copy code
2d5b30dd-1daa-4bb4-af6b-da4ea4e975cf REQUEST test-karaoke-performance-his-historylogger7C190503-GGOSGWNuWwtH [src/services/performance-history/KAR_HST_add_performance.handler] invoked
SyntaxError: Unexpected token n in JSON at position 0
    at JSON.parse (<anonymous>)
    at createStrictSyntaxError (/home/lukewyman/Documents/code/karaoke-backend-sst/node_modules/body-parser/lib/types/json.js:158:10)
• I've also simplified the subscribed lambda so that I'm not trying to do anything at all with the event:
Copy code
def handler(event, context):
    print('Inside the add performance handler!')
and I still get the exception shown above, while also printing
Inside the add performance handler!
to to the terminal. So, somehow, the subscribed lambda is falling apart with Live Lambda, but working as expected when deployed.
f
Hey @Luke Wyman, hmm… are
PerformanceCompleted
and
AddPerformance
in the same stack?
l
PerformanceCompleted
doesn't really exist outside of being the
detailType
string in my event bus rule in my
EventBusStack
. Over in the
RotationsStack
where the performance is actually marked complete, It's an environment variable for the Lambda that will
put_events
, and over in
PerformanceHistoryStack
, I've passed in the event rule so that the
AddPerformance
can be subscribed to it.
f
sorry i meant
KAR_ROT_complete_performance.py
and
KAR_HST_add_performance.py
, are they in the same stack or separate stacks?
l
KAR_ROT_complete_performance.py
is in the
RotationsStack
while
KAR_HST_add_performance.py
is in the
PerformanceHistoryStack
. The
EventBusStack
is shared between the two as needed to make the pub/sub for the custom event bus happen.
f
I see. Let me try to reproduce this.
Btw, does this issue happen consistently for you when running
sst start
after an
sst deploy
?