This guide provides specific instructions for handling secrets in the Replit environment, focusing on the unique challenges of syncing secrets between development and deployment.
Replit manages secrets in two separate environments:
- Development Environment - Your main workspace where you develop and test code
- Deployment Environment - The production environment where your deployed application runs
Important: Secrets do not automatically sync between these environments.
The Vector Knowledge Base application requires these secrets:
| Secret Name | Purpose |
|---|---|
SESSION_SECRET |
Used for securing user sessions |
BASIC_AUTH_USERNAME |
Username for HTTP Basic Authentication |
BASIC_AUTH_PASSWORD |
Password for HTTP Basic Authentication |
OPENAI_API_KEY |
API key for OpenAI integration |
VKB_API_KEY |
Application-specific API key (if used) |
- Open your Replit workspace
- Click on the "Tools" tab in the sidebar
- Select "Secrets"
- Click "Add a new secret"
- Enter the secret name and value
- Repeat for each required secret
- Go to your deployment page
- Click the three-dot menu (⋮) in the top right corner
- Select "Deployment Settings"
- Find the "Secrets" or "Environment Variables" section
- Add each secret with the same name and value as in your development environment
- Save your changes
- Redeploy your application for the changes to take effect
When a deployment shows "5 secrets out of sync" or similar message:
- This indicates that your deployment environment is missing secrets that exist in your development environment
- Follow the steps above to add the missing secrets to your deployment environment
- Redeploy the application
- Maintain a Secrets Inventory - Keep a secure record of all secrets used in your application
- Use Consistent Names - Use the same secret names in both environments
- Redeploy After Changes - Always redeploy after updating secrets
- Regular Audits - Periodically check that both environments have the same secrets
- Update Both Environments - When changing a secret, remember to update it in both places
If your application shows authentication issues after deployment:
- Check if your deployment shows "secrets out of sync"
- Verify that all required secrets are present in the deployment environment
- Ensure the values match exactly between environments
- Check application logs for specific error messages about missing secrets
- Redeploy the application after making changes to secrets
- Never share your secrets in public repositories or discussions
- Rotate secrets periodically according to your security policies
- Use strong, unique values for passwords and API keys
- Limit access to who can view and modify secrets in both environments