silvermine / serverless-plugin-cloudfront-lambda-edge

Adds Lambda@Edge support to Serverless
MIT License
296 stars 41 forks source link

`sls logs` does not seem to work with the plugin #38

Closed fgrehm closed 5 years ago

fgrehm commented 5 years ago

Hey, I'm just starting with the plugin but I'm wondering if this is supposed to work:

$ ./node_modules/.bin/sls logs -f apiOriginRequestLogger
  No existing streams for the function

I've checked cloudwatch and it seems to be working, but logs are going to a different log group like /aws/lambda/<aws-region>.<svc>-development-apiOriginRequestLogger instead of /aws/lambda/<svc>-development-apiOriginRequestLogger

jthomerson commented 5 years ago

Yeah, two issues (neither of which we can do anything to help you with unfortunately):

  1. CloudFront sends Lambda@Edge logs to a different path, as you noted. We have some comments about this that may add more detail if you need: https://github.com/silvermine/serverless-plugin-cloudfront-lambda-edge/blob/d2860cbc9e209a38d87d4fd96f56440356b9e3ca/src/index.js#L50-L58. Perhaps the Serverless framework could be patched to look in the Lambda@Edge location for the logs if it detects that the function is associated with Lambda@Edge, but that'd have to be done in the framework itself.
  2. Lambda@Edge functions are replicated to all regions, not just the one you deploy it to, so you'd possibly need to watch for logs in different regions.

Hope that helps