https://serverless-stack.com/ logo
#help
Title
# help
s

Sam Hulick

05/18/2022, 10:04 PM
💥 I’ve got a critical issue going on with 1.1.2. things were fine in 1.0 beta 7, but now one of my functions is throwing this error (see in thread)
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: Cannot convert undefined or null to object
pretty sure this is happening with the
import
of AWS AppSync
yep.
Copy code
import AWSAppSyncClient from 'aws-appsync';
...
console.log('y tho?', AWSAppSyncClient);
☝️ throws error
I don’t wanna assume this is just when working locally, so I’m really hesitant to push this to production
hey @Frank @thdxr - wanted to put this on your radar. obviously it’s a pretty severe edge case, as all of the other functions work just fine.
t

thdxr

05/19/2022, 4:08 AM
hm
just the import is causing this?
can you try a fake function where there's literally nothing but the import
s

Sam Hulick

05/19/2022, 4:09 AM
yeah if I remove the
console.log
it’s fine. but.. tree-shaking I assume
which is why I had to just log it, so there was a reference to it and it wasn’t removed from the build
t

thdxr

05/19/2022, 4:10 AM
and anything without this import is fine?
s

Sam Hulick

05/19/2022, 4:10 AM
yeah, most of my functions work fine. except the ones that depend on
AWSAppSyncClient
t

thdxr

05/19/2022, 4:11 AM
that is really odd, idk what on our end changed besides an update to cdk
can you create a simple function file like this
Copy code
import AWSAppSyncClient from "aws-appsync"

export function handler() {
  console.log(AWSAppSyncClient)
}
add it to your stack and send me what shows up in the
.sst/artifacts
folder
s

Sam Hulick

05/19/2022, 4:14 AM
sure thing, one sec
er.. well.. it’s gonna take a long time 😕 when going from 1.0 beta to 1.1, it updates every Lambda function and I have a lot
gimme like 10-15 mins
ok. whew. now lemme whip up that function
@thdxr ok, so what do you want to see? the file
.sst/artifacts/dev-microservices-api-misc-Lambda_GET_-abc/src/lambda/rest/functions/abc.js
is quite large
ok, downgrading to AppSync 4.0.0 works! strange that the latest version was ok in SST 1.0 beta but not 1.1.2
but this is probably AWS’s fault
f

Frank

05/19/2022, 4:53 AM
hmm.. was Function runtime changed when updating to 1.1.2? Nodejs 16 related by any chance?
s

Sam Hulick

05/19/2022, 5:04 AM
@Frank no, I’m hard set at 14.x
2 Views