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

fix!: remove print output option #1559

Merged
merged 1 commit into from
Sep 2, 2022
Merged

fix!: remove print output option #1559

merged 1 commit into from
Sep 2, 2022

Conversation

dnalborczyk
Copy link
Collaborator

@dnalborczyk dnalborczyk commented Sep 1, 2022

Description

this PR removes the --printOuput flag. this can be easily accomplished by just using console.log in your own lambda code, or by just reading the http status code and the response body in a REST client. it's less code and one option less to maintain.

BREAKING, next major release, v10

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

@dnalborczyk dnalborczyk changed the title fix!: remove print ouput option fix!: remove print output option Sep 1, 2022
@dnalborczyk dnalborczyk merged commit 9f31825 into master Sep 2, 2022
@dnalborczyk dnalborczyk deleted the remove-print-output branch September 2, 2022 22:58
@qtiki
Copy link

qtiki commented Sep 14, 2022

this can be easily accomplished by just using console.log in your own lambda code

I just upgraded serverless-offline from v5.x to the latest v10.0.2 and my console.log from our Lambdas is not showing up at all. I tried the --printOutput flag as it's still listed in the command line options documentation but obviously it now throws an error as it doesn't exist anymore.

Am I missing something here?

@dnalborczyk
Copy link
Collaborator Author

dnalborczyk commented Sep 14, 2022

yeah, --printOutput was removed. you are not seeing any console.log at all? are you using any third party logging libraries? what is the node.js version, serverless version, and operating system you use? there was a known coloring problem with worker-threads, but the console.log with coloring should also just work.

@qtiki
Copy link

qtiki commented Sep 14, 2022

We're not using third party logging but we do use sentry.io which might do some console.log overrides for the breadcrumb tracing.

I've been testing this a bit and I am able to log something but so far it seems very randomly work depending on which module I'm using it from. So it might very well be an import order thing related to the console.log override.

@dnalborczyk
Copy link
Collaborator Author

dnalborczyk commented Sep 14, 2022

I would not recommend it for a variety of reasons, but if you absolutely need console.log to work right now until we figure out what the problem is, you can use the --useInProcess option. that runs the handler the same way as previously pre-v9.0. the only thing what does not work anymore is handler reloading for development, as it was buggy and leaking memory. if that is also important to you, you might have to use something like nodemon for handler reloading (which would re-start the entire node.js serverless/serverless-offline process).

I know that there's an issue that console.log from child worker threads are only being flushed when the parent has free resources to do so (empty event loop)

@qtiki
Copy link

qtiki commented Sep 20, 2022

No need to investigate this further. In the end this was a user error on my part as I was actually looking for debug logs on a feature I had accidentally disabled in my dev env. Sorry to have wasted your time.

@dnalborczyk
Copy link
Collaborator Author

no problem, glad it is working now!

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

Successfully merging this pull request may close these issues.

2 participants