serverless-components / express

⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
https://serverless.com/components
Apache License 2.0
375 stars 34 forks source link

Streaming logs not working with serverless dev #32

Closed gjgd closed 4 years ago

gjgd commented 4 years ago

I'm trying out the serverless dev feature (which is amazing btw!). Auto deploying works perfectly, but I'm unable to see logs.

I tried to add a console.log to the example like this:

app.get('/*', (req, res) => {
  console.log('hello world')
  res.send(`Hello. Request received: ${req.method} - ${req.path}`);
});

but I'm not seeing the "hello world" in the cli output where I ran serverless dev.

I tried to add the CloudWatchFullAccess permission to my serverless IAM user, thinking it was a permission error but it didn't change the result.

eahefnawy commented 4 years ago

Hmmm they seem to work on my side. Which version of the CLI are you using? Maybe you need an update?

gjgd commented 4 years ago

This is the version I use:

➜ sls --version

serverless ⚡framework

components version: 2.34.1

I tried giving full admin permissions to my serverless IAM user as well, still no logs.

eahefnawy commented 4 years ago

@gjgd You're right, we uncovered a bug that caused this, and just fixed it. Could you reinstall with npm i -g serverless and try again? I think it should work now.

gjgd commented 4 years ago

Yes that fixed it, logs are working with version 2.34.3 Thanks! Closing

theBliz commented 3 years ago

@eahefnawy sorry for re-opening a closed thread but I'm having a similar issue with

serverless ⚡framework

components version: 3.7.3

while using the native terminal in VS Code configured to work externally with iTerm.

The watch on changes works fine but no logs are shown.

I've simplified my functions, but also with something as simple as

app.get("/*", (req,res) =>{
  console.log('hello world')
  res.send(`Hello. Request received: ${req.method} - ${req.path}`);
})

there is no log on the terminal.

I've tried to execute serverless dev directly from iTerm instead of doing it from VS Code and the logs show up.

Do have any idea why this might happen?

UPDATE seems that even in the iTerm the logs show up only when I execute serverless dev the first time. On updating an endpoint, the logs are not showing anymore.