# Environment Variables or Secrets Not Available in Published Base44 App

Your Base44 app uses environment variables or secret keys (for API integrations, database connections, or third-party services), but these values are not available in the published version of the app. Features that depend on these variables work in the editor but fail in production.

This commonly manifests as API calls returning authentication errors, integrations silently failing, or features that depend on configuration values behaving differently in the published app.

## Error Messages You Might See

- API key is missing or invalid
- Environment variable undefined
- 403 Forbidden
- Authentication failed: missing credentials

[API key is missing or invalid](/content/guides/search?q=API%20key%20is%20missing%20or%20invalid "Search for this error"/index.html)  
[Environment variable undefined](/content/guides/search?q=Environment%20variable%20undefined "Search for this error"/index.html)  
[403 Forbidden](/content/guides/search?q=403%20Forbidden "Search for this error"/index.html)  
[Authentication failed: missing credentials](/content/guides/search?q=Authentication%20failed:%20missing%20credentials "Search for this error"/index.html)

## Common Causes

1. Environment variables were set in the editor or preview environment but not in the production deployment settings
2. The variable names are slightly different between environments (typo or case difference)
3. Secrets are being exposed in client-side code instead of being used in server-side functions only
4. The app was re-published but the environment variables were not refreshed or re-deployed

## How to Fix It

Check your Base44 app's deployment or environment settings to ensure all required variables are set for the production environment, not just the preview environment. Variable names must match exactly, including case.

Ensure that sensitive keys and secrets are only accessed in server-side code or functions. If they're referenced in client-side code, they may be stripped out during the build for security reasons.

For apps with many environment-dependent integrations, a developer can audit the configuration and ensure all variables are properly set and accessible in every environment.

## Frequently Asked Questions

**Why do my API keys work in Base44 preview but not when published?**  
Environment variables are often configured separately for preview and production. Check your deployment settings to ensure all variables are set for the production environment.

**Are my API keys safe in Base44?**  
Only use secrets in server-side functions, never in client-side code. Client-side code is visible to users and may have secrets stripped during the build process.
