Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverless logs stopped working #7214

Closed
charlieongithub opened this issue Jan 14, 2020 · 2 comments · Fixed by #7270 or mikaelvesavuori/serverless-graphql-api-gcp#4
Closed

serverless logs stopped working #7214

charlieongithub opened this issue Jan 14, 2020 · 2 comments · Fixed by #7270 or mikaelvesavuori/serverless-graphql-api-gcp#4

Comments

@charlieongithub
Copy link

charlieongithub commented Jan 14, 2020

Bug Report

sls logs -f functionName -t stopped working after upgrade to 1.61.0 from 1.57.0

Description

I've upgraded the serverless framework today and since then I don't see any output coming out of the sls logs command. It is just hanging in there. I can however see the logs on CloudWatch directly.

  1. What did you do?

I've upgraded the serverless framework today.

I didn't change any configuration in my serverless.yml other than configuring provisionedConcurrency: 5

  1. What happened?
    Since then I don't see any output coming out from the sls logs command. It is just hanging in there.

  2. What should've happened?

The latest logs from AWS Lambda should appear in the console

  1. What's the content of your serverless.yml file?
...
provider:
  region: eu-central-1
  name: aws
  runtime: nodejs10.x
  timeout: 30
  stage: ${self:custom.secrets.NODE_ENV}
  environment:
    NODE_ENV: ${self:custom.secrets.NODE_ENV}
    DB_HOST: ${self:custom.secrets.DB_HOST}
    DB_USER: ${self:custom.secrets.DB_USER}
    DB_NAME: ${self:custom.secrets.DB_NAME}
    DB_PASSWORD: ${self:custom.secrets.DB_PASSWORD}
    DB_PORT: ${self:custom.secrets.DB_PORT}
  vpc:
    securityGroupIds:
      - ${self:custom.secrets.SECURITY_GROUP_ID}
    subnetIds:
      - ${self:custom.secrets.SUBNET1_ID}
      - ${self:custom.secrets.SUBNET2_ID}
      - ${self:custom.secrets.SUBNET3_ID}

functions:
  functionName:
    provisionedConcurrency: 5
    handler: src/handler.functionName
    events:
      - http:
          method: get
          path: test
          integration: lambda
          cors: true
...
@medikoo
Copy link
Contributor

medikoo commented Jan 14, 2020

@charlieongithub thanks for report. I assume it could be related to fact that function with configured provisioned concurrency is invoked against provisioned alias and not $LATEST and I take logs are by default taken from $LATEST.

Nonetheless it's a bug in a framework, we should with such configuration look for logs in provisioned alias.

PR's with fix welcome

@preshetin
Copy link
Contributor

I've made a PR that fixes it. I noticed that all logs are actually fetched from AWS. But, for some reason, only logs with [$LATEST] version are shown.

https://github.com/serverless/serverless/blob/master/lib/plugins/aws/logs/index.js#L55

When using the provisioned concurrency option, logs are sometimes shown with not [$LATEST] but [1] or [2] version with prevents it from showing in current implementation.

The reason why the mentioned line exists is misty to me. So, I created a PR that removes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants