This Firebase Hosting error occurs when attempting to deploy a modern web framework (Next.js, Angular, React, etc.) without enabling the experimental webframeworks feature in Firebase CLI. The error prevents deployment of framework-aware hosting configurations that support server-side rendering and other framework-specific features.
The "Cannot deploy web framework from source - experiment not enabled" error in Firebase Hosting indicates that you're trying to deploy a web framework application (such as Next.js, Angular, Nuxt, or other SSR-capable frameworks) using Firebase's framework-aware hosting features, but the experimental webframeworks flag is not enabled in your Firebase CLI. Firebase Hosting's framework-aware features are designed to integrate with modern web frameworks, allowing you to deploy applications with server-side rendering (SSR), incremental static regeneration (ISR), and other dynamic features. These applications are deployed differently than traditional static sites—they require Cloud Functions for server-side logic and special build configurations. The webframeworks experiment is an early public preview feature that enables: 1. Automatic framework detection and configuration 2. Server-side rendering support via Cloud Functions 3. Build optimization for framework-specific patterns 4. Seamless integration with framework routing and API routes 5. Support for Next.js, Angular, Nuxt, SvelteKit, and other frameworks This error commonly appears when: - Your firebase.json specifies a "source" field instead of "public" (indicating framework deployment) - You're deploying a Next.js app with SSR features - Your project uses Angular Universal or other SSR frameworks - CI/CD pipelines deploy framework applications without the experiment enabled - Multiple developers work on the same project with different CLI configurations Firebase is transitioning framework deployments to Firebase App Hosting (now GA), which provides full production support. However, many existing projects still use the experimental webframeworks feature in Firebase Hosting.
The primary fix is to enable the webframeworks experimental feature:
Enable the experiment globally:
firebase experiments:enable webframeworksThis command enables the experiment for all Firebase projects on your machine.
Verify the experiment is enabled:
firebase experiments:listYou should see webframeworks listed as enabled:
Experiments:
✓ webframeworks - Framework-aware HostingCheck your Firebase CLI version:
firebase --versionEnsure you're using Firebase CLI version 12.1.0 or later (12.4.0+ recommended for better framework support).
Update Firebase CLI if needed:
npm install -g firebase-toolsAfter enabling the experiment, try deploying again:
firebase deploy --only hostingIf deployment works locally but fails in CI/CD, you need to enable the experiment in your pipeline:
GitHub Actions workflow example:
name: Deploy to Firebase Hosting
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Enable webframeworks experiment
run: firebase experiments:enable webframeworks
- name: Deploy to Firebase Hosting
run: firebase deploy --only hosting --token ${{ secrets.FIREBASE_TOKEN }}
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}Key points:
1. Add the firebase experiments:enable webframeworks step BEFORE deployment
2. Ensure Firebase CLI is installed in the CI environment
3. Use Firebase token for authentication in CI/CD
4. Set the token as a GitHub secret
Generate Firebase token for CI/CD:
firebase login:ciThis generates a token you can use in FIREBASE_TOKEN secret.
Alternative: Use Firebase GitHub Action:
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
projectId: your-project-id
env:
FIREBASE_CLI_EXPERIMENTS: webframeworksSet the environment variable FIREBASE_CLI_EXPERIMENTS: webframeworks to enable the experiment.
Check your firebase.json to ensure it's properly configured for framework deployment:
Framework-aware configuration (requires webframeworks experiment):
{
"hosting": {
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "us-central1"
}
}
}Key differences from static hosting:
- Uses "source": "." instead of "public": "dist" or "public": "build"
- Optional frameworksBackend for SSR configuration
- Firebase automatically detects framework (Next.js, Angular, etc.)
Static site configuration (doesn't require webframeworks):
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}Mixed configuration (multiple hosting targets):
If you have both static and framework-based sites:
{
"hosting": [
{
"target": "static-site",
"public": "public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
},
{
"target": "nextjs-app",
"source": ".",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"frameworksBackend": {
"region": "us-central1"
}
}
]
}Important: Ensure you're deploying the correct target:
firebase deploy --only hosting:nextjs-appCommon configuration issues:
- Missing "source" field for framework apps
- Using "public" when you should use "source"
- Incorrect framework detection due to missing framework config files
- Region not specified for frameworksBackend
If you're setting up a new project or need to reconfigure, properly initialize Firebase Hosting:
Initialize Firebase in your project:
# Enable webframeworks first
firebase experiments:enable webframeworks
# Initialize Firebase
firebase init hostingDuring initialization:
1. Select "Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys"
2. When asked about framework detection, choose "Yes" if you want Firebase to auto-detect
3. Select your framework (Next.js, Angular, etc.) or let Firebase auto-detect
4. Choose deployment options (GitHub Actions, etc.)
For Next.js projects:
# Create Next.js app if needed
npx create-next-app@latest my-app
cd my-app
# Enable experiment
firebase experiments:enable webframeworks
# Initialize Firebase
firebase init hosting
# Select Next.js when prompted
# Firebase will configure firebase.json automaticallyFor Angular projects:
# Create Angular app if needed
ng new my-app
cd my-app
# Enable experiment
firebase experiments:enable webframeworks
# Initialize Firebase
firebase init hosting
# Select Angular when promptedManual framework configuration:
If auto-detection fails, you can manually configure in firebase.json:
{
"hosting": {
"source": ".",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"frameworksBackend": {
"region": "us-central1",
"maxInstances": 100,
"minInstances": 0,
"concurrency": 80
}
}
}Verify framework detection:
firebase deploy --only hosting --debugLook for lines indicating framework detection:
[debug] Detected Next.js framework
[debug] Building Next.js application...Firebase App Hosting is now generally available (GA) and is the recommended approach for framework deployments:
Why consider App Hosting:
- Fully supported for production (not experimental)
- Better performance and scalability
- Native support for Next.js and Angular
- Improved build and deployment pipeline
- Production SLA and support
Check if App Hosting is right for you:
- You're deploying Next.js or Angular applications
- You need server-side rendering (SSR)
- You want production-grade support
- You're starting a new project
Initialize App Hosting instead:
firebase init apphostingKey differences from framework-aware Hosting:
- App Hosting uses Cloud Run instead of Cloud Functions
- Better cold start performance
- Automatic scaling and load balancing
- Integrated CI/CD with GitHub
- No experimental flags needed
Migration from webframeworks to App Hosting:
1. Review the [App Hosting documentation](https://firebase.google.com/docs/app-hosting)
2. Backup your current configuration
3. Initialize App Hosting in your project
4. Test deployment to App Hosting
5. Update DNS/custom domains as needed
When to stay with framework-aware Hosting:
- You have an existing project that works well
- You don't want to migrate infrastructure
- You're using frameworks not yet supported by App Hosting
- You need specific Hosting features not available in App Hosting
Continue using webframeworks experiment:
If you choose to stay with framework-aware Hosting, ensure:
- All developers enable the experiment
- CI/CD pipelines include experiment enablement
- Document the requirement in your project README
- Monitor Firebase announcements for changes to experimental features
If enabling the experiment doesn't resolve the issue, try these troubleshooting steps:
1. Clear Firebase cache and retry:
# Clear Firebase cache
rm -rf .firebase/
rm -rf .next/ # For Next.js
rm -rf dist/ # For Angular
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
# Enable experiment again
firebase experiments:enable webframeworks
# Deploy
firebase deploy --only hosting2. Check for conflicting Firebase CLI installations:
# Check which firebase is being used
which firebase
# Check for multiple installations
npm list -g firebase-tools
# Uninstall all versions
npm uninstall -g firebase-tools
# Reinstall latest version
npm install -g firebase-tools@latest
# Enable experiment
firebase experiments:enable webframeworks3. Verify billing is enabled (required for SSR):
- Server-side rendering requires Cloud Functions
- Cloud Functions require Blaze (pay-as-you-go) plan
- Check Firebase Console > Usage and billing
4. Check Cloud Functions quota:
# Deploy with verbose logging
firebase deploy --only hosting --debugLook for quota errors or function deployment failures.
5. Test with a simple framework app:
Create a minimal test project to isolate the issue:
# Create test Next.js app
npx create-next-app@latest test-app
cd test-app
# Enable experiment
firebase experiments:enable webframeworks
# Initialize Firebase
firebase init hosting
# Deploy
firebase deploy --only hostingIf this works, the issue is with your project configuration.
6. Check for framework version compatibility:
- Ensure your framework version is supported
- Update to latest framework version if possible
- Check [Firebase framework compatibility](https://firebase.google.com/docs/hosting/frameworks/frameworks-overview)
7. Review deployment logs:
firebase deploy --only hosting --debug 2>&1 | tee deploy.logReview deploy.log for specific error messages or stack traces.
### Understanding Firebase Framework-Aware Hosting
Firebase's framework-aware hosting is built on top of traditional Firebase Hosting but adds automatic framework detection and server-side rendering capabilities.
Architecture:
- Static assets: Served from Firebase Hosting CDN (fast, global)
- Server-side logic: Deployed to Cloud Functions for Firebase
- Framework detection: Firebase CLI analyzes your project to determine framework
- Build process: Framework-specific build runs automatically
- Routing: Firebase translates framework routing to Hosting rewrites
Supported frameworks:
- Next.js (pages router and app router)
- Angular (with Angular Universal for SSR)
- Nuxt.js (Vue framework)
- SvelteKit
- Astro (with SSR enabled)
- Vite-based frameworks
Experimental status implications:
- Feature is in early public preview
- No SLA or deprecation policy
- APIs and behavior may change
- Not recommended for critical production workloads
- Limited support compared to GA features
App Hosting vs Framework-Aware Hosting:
| Feature | Framework-Aware Hosting | App Hosting (GA) |
|---------|-------------------------|------------------|
| Status | Experimental | Generally Available |
| Backend | Cloud Functions | Cloud Run |
| Cold starts | Slower | Faster |
| Support | Limited | Full production support |
| Frameworks | Multiple | Next.js, Angular |
| Pricing | Functions pricing | Cloud Run pricing |
### Security and Performance Considerations
Function security:
- SSR functions run with service account credentials
- Ensure environment variables don't leak secrets
- Use Firebase App Check for API protection
- Review function permissions and IAM roles
Performance optimization:
1. Minimize SSR usage: Pre-render pages when possible
2. Enable caching: Use Firebase Hosting cache headers
3. Optimize function resources: Configure memory and timeout appropriately
4. Use CDN for static assets: Keep static files in Hosting, not Functions
5. Monitor cold starts: Consider min instances for frequently-used functions
Cost management:
- Cloud Functions pricing applies to SSR
- Each SSR request invokes a function
- Static pages are served from CDN (cheaper)
- Consider caching strategies to reduce function invocations
- Monitor usage in Firebase Console
### Team Collaboration
Ensure consistent configuration across team:
1. Document experiment requirement in README:
## Prerequisites
- Node.js 18+
- Firebase CLI 12.4.0+
- Enable webframeworks experiment: `firebase experiments:enable webframeworks`2. Add to onboarding checklist:
- Install Firebase CLI
- Run firebase experiments:enable webframeworks
- Test deployment with firebase deploy --only hosting
3. Create setup script:
#!/bin/bash
# setup-firebase.sh
echo "Setting up Firebase development environment..."
# Install Firebase CLI
npm install -g firebase-tools
# Enable webframeworks experiment
firebase experiments:enable webframeworks
# Login to Firebase
firebase login
echo "Setup complete! Run 'firebase deploy --only hosting' to deploy."4. Configure CI/CD environment variables:
- Set FIREBASE_CLI_EXPERIMENTS=webframeworks in CI environment
- Document in deployment documentation
- Include in pipeline configuration
### Migration Strategies
From static hosting to framework-aware hosting:
1. Backup existing configuration:
cp firebase.json firebase.json.backup2. Update firebase.json incrementally:
- Test with a preview channel first
- Gradually migrate routes to framework
- Keep static fallbacks during transition
3. Use multiple hosting targets:
{
"hosting": [
{
"target": "legacy",
"public": "public"
},
{
"target": "app",
"source": "."
}
]
}4. Test thoroughly before production:
- Deploy to preview channels
- Test all routes and dynamic features
- Monitor performance and costs
- Have rollback plan ready
From framework-aware hosting to App Hosting:
1. Review App Hosting [migration guide](https://firebase.google.com/docs/app-hosting)
2. Set up App Hosting in parallel
3. Test with subset of traffic
4. Switch DNS/routing when confident
5. Monitor and optimize
### Troubleshooting Edge Cases
Issue: Experiment enabled but still getting error:
- Check if experiment is enabled globally: firebase experiments:list
- Try per-project experiment file: Create .firebaserc with experiments config
- Verify Firebase CLI version: Must be 12.1.0+
Issue: Works locally but fails in CI:
- Ensure CI runs firebase experiments:enable webframeworks before deploy
- Check CI uses same Firebase CLI version as local
- Verify CI environment has proper authentication
Issue: Multiple developers, inconsistent behavior:
- Document experiment requirement prominently
- Add experiment check to pre-deploy scripts
- Use shared development practices document
Issue: Deploy succeeds but site doesn't work:
- Check Cloud Functions logs for SSR errors
- Verify billing is enabled (required for Functions)
- Review framework build output for issues
- Check browser console for client-side errors
messaging/UNSPECIFIED_ERROR: No additional information available
How to fix "messaging/UNSPECIFIED_ERROR: No additional information available" in Firebase Cloud Messaging
App Check: reCAPTCHA Score Too Low
App Check reCAPTCHA Score Too Low
storage/invalid-url: Invalid URL format for Cloud Storage reference
How to fix invalid URL format in Firebase Cloud Storage
auth/missing-uid: User ID identifier required
How to fix "auth/missing-uid: User ID identifier required" in Firebase
auth/invalid-argument: Invalid parameter passed to method
How to fix "auth/invalid-argument: Invalid parameter passed to method" in Firebase