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

L-1016 By default, don't check ENV vars in Vercel preview/development env #14

Merged
merged 4 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 84 additions & 70 deletions examples/logger/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/logger/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { log } from '@logtail/next'
import { AppProps } from "next/app";
import Link from "next/link";

export { reportWebVitals } from '@logtail/next'

Expand All @@ -10,8 +11,8 @@ function MyApp({ Component, pageProps }: AppProps) {
<Component {...pageProps} />
<hr />
<ul>
<li><a href="/">Homepage</a></li>
<li><a href="/serverSideProps">Server side props demo</a></li>
<li><Link href="/">Homepage</Link></li>
<li><Link href="/serverSideProps">Server side props demo</Link></li>
</ul>
</>
}
Expand Down
5 changes: 4 additions & 1 deletion src/withLogtail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ declare global {
}

function warnAboutMissingEnvironmentVariables() {
let checkEnabled = process.env.NODE_ENV !== 'development';
const nodeEnvironment = process.env.NODE_ENV;
const vercelEnvironment = process.env.VERCEL_ENV;
let checkEnabled =
nodeEnvironment !== 'development' && vercelEnvironment !== 'preview' && vercelEnvironment !== 'development';
if (process.env.LOGTAIL_CHECK_ENV_VARS?.toLowerCase() === 'true' || process.env.LOGTAIL_CHECK_ENV_VARS === '1') {
checkEnabled = true;
}
Expand Down