-
Notifications
You must be signed in to change notification settings - Fork 3
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
How to hide build warnings for local development #6
Comments
Hi @jakeleventhal, Thank you for raising this! These warnings are supposed to help people avoid forgetting to specify important ENV vars in prod and losing logs. We want to be transparent to prevent mistakes. We could add another ENV variable to suppress these warnings. Are the warnings annoying enough during development that you want to disable them? Thanks again for reaching out. |
Yes @curusarn, i think maybe if node_env is not production they should be suppressed |
@curusarn I'm with @jakeleventhal on this and would love a way to suppress the warnings |
Thank you for the feedback! We're tracking the issue internally. We should get to fixing it soon. |
Hello @jakeleventhal and @alexmarmon, thanks for pushing this! 🙌 Just released Hope that helps! 🙂 |
On my local environment with
|
Seems you have set different Could you try running it with |
Yeah it works. when i run build it just default to NODE_ENV=production? all i am doing is running I think this is default vercel behavior. maybe |
It worked nicely with my setup (without involving Vercel). Now at least, the detection can be suppressed for local development, which is a good thing 🙂 |
Yeah, but I think a better solution ought to exist considering vercel tooling is super common with next.js |
If it doesn't work for you, the ENV vars are probably not accessible in your app. |
the env var is accessible in my app it just doesnt seem to be accessible in what do you propose? it seems overkill to ask all vercel users to maintain a .env file specifically for suppressing logtail logs |
Hi @jakeleventhal, thanks for the follow-up. You're right, in Vercel there's different way of determining the app environment (via I'm addressing this in #14. After updating to v0.1.3, you shouldn't see the warning during |
This is on I manually edited the dist for logtail where it prints the logs and added: var log = new logger_1.Logger();
Object.entries(process.env)
.filter(([key]) => key.startsWith('VERCEL'))
.forEach(([key, value]) => {
log.warn(key + ' - ' + value)
});
log.warn('logtail: Envvars not detected. If this is production please see https://github.com/logtail/logtail-nextjs for help');
log.warn('logtail: Sending Web Vitals to /dev/null');
log.warn('logtail: Sending logs to console'); and the following were printed:
Some other non-filtered relevant env vars:
|
@jakeleventhal Interesting... 🤔 Thanks for the further details on this. What's your I tested the change with Vercel CLI 32.5.6 |
Sorry, I can see that in your log output - Vercel CLI 32.5.3 |
@jakeleventhal I'm having difficulty replicating it. Could you please check that #15 works in your case? 🙏 |
Is there a canary release or a compiled dist file? Having trouble generating it locally |
@jakeleventhal There's no pre-release at the moment, I assumed you could edit the dist manually, just as you did in #6 (comment). |
This one is a bit trickier as the compiled js is quite different and ther are a lot of conditions here. can you provide a snippet of the compiled |
From function warnAboutMissingEnvironmentVariables() {
var _a, _b;
var nodeDevEnv = process.env.NODE_ENV === 'development';
var vercelDevEnv = process.env.VERCEL_ENV === 'preview' || process.env.VERCEL_ENV === 'development';
var vercelNonProdBuild = process.env.VERCEL_ENV !== 'production' && process.env.__VERCEL_BUILD_RUNNING === '1';
var checkEnabled = !nodeDevEnv && !vercelDevEnv && !vercelNonProdBuild;
if (((_a = process.env.LOGTAIL_CHECK_ENV_VARS) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true' || process.env.LOGTAIL_CHECK_ENV_VARS === '1') {
checkEnabled = true;
}
if (((_b = process.env.LOGTAIL_CHECK_ENV_VARS) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'false' || process.env.LOGTAIL_CHECK_ENV_VARS === '0') {
checkEnabled = false;
}
if (checkEnabled) {
var log = new logger_1.Logger();
log.warn('logtail: Envvars not detected. If this is production please see https://github.com/logtail/logtail-nextjs for help');
log.warn('logtail: Sending Web Vitals to /dev/null');
log.warn('logtail: Sending logs to console');
}
} |
works for me, good to merge that PR |
Thanks for the cooperation on this one, @jakeleventhal 👍 Just released v0.1.4 with the verified fix 🚀 |
I just verified |
whenever i build my app locally, i get the following errors. How do i suppress these?
The text was updated successfully, but these errors were encountered: