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

Add a way to suppress WARN for stackdriver NODE_ENV setup #460

Open
defunctzombie opened this issue Mar 29, 2020 · 7 comments
Open

Add a way to suppress WARN for stackdriver NODE_ENV setup #460

defunctzombie opened this issue Mar 29, 2020 · 7 comments
Labels
api: clouderrorreporting Issues related to the googleapis/nodejs-error-reporting API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@defunctzombie
Copy link

defunctzombie commented Mar 29, 2020

When I run my unit tests, the stdout contains lots of the following warning:

WARN:@google-cloud/error-reporting: The stackdriver error reporting client is configured to report errors if and only if the NODE_ENV environment variable is set to "production". Errors will not be reported. To have errors always reported, regardless of the value of NODE_ENV, set the reportMode configuration option to "always".

This happens because my unit tests invoke my entire app (a koa2 app) which includes the error reporting setup.

I'd like a way to suppress this warning for testing - maybe by handling NODE_ENV=test or a configuration option.

@product-auto-label product-auto-label bot added the api: clouderrorreporting Issues related to the googleapis/nodejs-error-reporting API. label Mar 29, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 29, 2020
@defunctzombie
Copy link
Author

Actually I'd like to amend the request. Upon setting the reportMode to never by checking the environment variable myself, I still get the following output:

ERROR:@google-cloud/error-reporting: Unable to find credential information on instance. This library will be unable to communicate with the Stackdriver API to save errors. Message: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.

My expectation was that when I disable reporting, the library does not attempt to lookup any credentials or perform any other actions. Basically becomes a no-op.

@bcoe bcoe added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 30, 2020
@bcoe
Copy link
Contributor

bcoe commented Mar 30, 2020

@defunctzombie this seems like a reasonable expectation 👌

@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Mar 30, 2020
@laljikanjareeya
Copy link

@defunctzombie reportMode can have one of three values:

production (default)
Only report errors if NODE_ENV is set to production.

always
Always report errors regardless of the value of NODE_ENV.

never
Never report errors regardless of the value of NODE_ENV.

So in case of never and always it never gives any warning.

In case of production it checks the NODE_ENV variable and if it's not set to production it will gives you warning.

The above functionality is working as expected 1.1.3 version and above.

@bcoe I think this is fair behavior WDYT?

@laljikanjareeya laljikanjareeya self-assigned this Nov 13, 2020
@keenan-devrel keenan-devrel added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Nov 13, 2020
@bachlis
Copy link

bachlis commented Nov 19, 2020

@laljikanjareeya sorry for jumping in, but why throw a warning if I specifically have changed the NODE_ENV variable? For example when running unit tests this adds too much noise to the output. It would be nice to be able to "silence" those warnings.

@laljikanjareeya
Copy link

laljikanjareeya commented Nov 25, 2020

@bachlis It throws a warning when both NODE_ENV and reportMode are not the same, I will take a look into unit test output.

@wtesler
Copy link

wtesler commented Dec 13, 2020

Yes, it would be a nice warning to silence. It's very common setup to have these logs only produced in production.

@0xSage 0xSage assigned simonz130 and unassigned 0xSage Jun 29, 2021
@simonz130 simonz130 assigned losalex and unassigned simonz130 Feb 14, 2022
@losalex losalex added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 28, 2022
@losalex losalex removed their assignment Jul 3, 2023
@tohagan
Copy link

tohagan commented Apr 12, 2024

Its very annoying to still have this unnecessary message filling up my log files. Please remove!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: clouderrorreporting Issues related to the googleapis/nodejs-error-reporting API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests