I found a plugin: https://www.npmjs.com/package/serverless-offline
But it emulates AWS lambda. I write a HTTP function and test it, print out the second argument of the function:
res: {"functionName":"cedar-cloud-functions-dev-sendEmail","functionVersion":"offline_functionVersion_for_cedar-cloud-functions-dev-sendEmail","invokedFunctionArn":"offline_invokedFunctionArn_for_cedar-cloud-functions-dev-sendEmail","awsRequestId":"offline_awsRequestId_23960008909951136","logGroupName":"offline_logGroupName_for_cedar-cloud-functions-dev-sendEmail","logStreamName":"offline_logStreamName_for_cedar-cloud-functions-dev-sendEmail","identity":{},"clientContext":{}}
As you can see, there is an awsRequestId
property, so this second argument should be the context
in AWS lambda, not the res
in GCF.
Is there a plugin emulates google cloud function on the local machine?