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

bug: Public and secret keys should not be required at build time #1829

Closed
Stadly opened this issue Apr 24, 2024 · 5 comments
Closed

bug: Public and secret keys should not be required at build time #1829

Stadly opened this issue Apr 24, 2024 · 5 comments

Comments

@Stadly
Copy link

Stadly commented Apr 24, 2024

Describe the bug

The public key and secret key are required when building the application with Vite. I think they should only be required at runtime, so the build system does not need to know the keys used when running the application.

To reproduce

https://stackblitz.com/edit/sveltejs-kit-template-default-qeurfm?file=src%2Froutes%2F%2Bpage.server.js

Run npm run build in the terminal. You'll get the error

publicKey is required, but was not provided. It can be provided as an argument or as an environment variable LANGFUSE_PUBLIC_KEY.

Additional information

I'm using the JS/TS SDK.

Copy link
Member

Thanks for reporting, I think the best way forward here is to just disable langfuse tracing if no secrets are configured instead of throwing exceptions. This'd be helpful to only run instrumentation in certain environments and not in tests.

@Stadly
Copy link
Author

Stadly commented Apr 25, 2024

I'm concerned that silently disabling Langfuse will trip up people when setting up the project. I guess there should be a way to require an env var during runtime but not during build time? Sounds like a common problem to encounter.

Copy link
Member

I'd suggest logging a single warning ("langfuse environment variables not set, tracing disabled"). I think I have seen this behavior with Sentry, Betterstack, Posthog, …

@Stadly
Copy link
Author

Stadly commented Apr 25, 2024

Yes, that sounds reasonable 👍

@marcklingen
Copy link
Member

Moved this to #1910 as there was another user requesting this

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

No branches or pull requests

2 participants