How to fix Hosting: Cannot deploy web framework from source - experiment not enabled in Firebase

FirebaseINTERMEDIATEMEDIUMUpdated Dec 15, 2025· 105 views

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.

Quick fix

Fixes Hosting: Cannot deploy web framework from source - experiment not enabled

firebase experiments:enable webframeworks
  1. Enable the webframeworks experiment in Firebase CLI
  2. Enable webframeworks in CI/CD pipelines (GitHub Actions)
  3. Verify your firebase.json configuration
  4. Initialize Firebase Hosting with framework support
firebase — error
firebase experiments:enable webframeworks
Hosting: Cannot deploy web framework from source - experiment not enabled

What this error means

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.

Typical symptoms

  • Firebase deploy command fails with 'experiment not enabled' error message
  • Deployment works for static sites but fails for framework applications
  • Error occurs specifically when firebase.json contains 'source' field instead of 'public'
  • CI/CD pipelines fail during Firebase Hosting deployment step
  • Deployment succeeds locally but fails in GitHub Actions or other CI environments
  • Error message mentions 'webframeworks' experiment explicitly
  • Next.js, Angular, or other framework apps cannot be deployed to Firebase Hosting

Common causes

  1. The webframeworks experiment is not enabled in Firebase CLI (most common)
  2. Using firebase.json with 'source' field without enabling the experimental feature
  3. CI/CD environment has a different Firebase CLI configuration than local development
  4. Firebase CLI version is outdated and doesn't support webframeworks experiment
  5. Project initialized with framework support but experiment not enabled globally or per-project
  6. Multiple Firebase Hosting targets with mixed static and framework configurations
  7. GitHub Actions or CI pipeline doesn't run firebase experiments:enable command
  8. Team members have inconsistent Firebase CLI configurations

How to fix "Hosting: Cannot deploy web framework from source - experiment not enabled"

1Enable the webframeworks experiment in Firebase CLI

The primary fix is to enable the webframeworks experimental feature:

Enable the experiment globally:

bash
firebase experiments:enable webframeworks

This command enables the experiment for all Firebase projects on your machine.

Verify the experiment is enabled:

bash
firebase experiments:list

You should see webframeworks listed as enabled:

bash
Experiments:
  ✓ webframeworks - Framework-aware Hosting

Check your Firebase CLI version:

bash
firebase --version

Ensure you're using Firebase CLI version 12.1.0 or later (12.4.0+ recommended for better framework support).

Update Firebase CLI if needed:

bash
npm install -g firebase-tools

After enabling the experiment, try deploying again:

bash
firebase deploy --only hosting
2Enable webframeworks in CI/CD pipelines (GitHub Actions)

If deployment works locally but fails in CI/CD, you need to enable the experiment in your pipeline:

GitHub Actions workflow example:

yaml
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:

bash
firebase login:ci

This generates a token you can use in FIREBASE_TOKEN secret.

Alternative: Use Firebase GitHub Action:

yaml
- 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: webframeworks

Set the environment variable FIREBASE_CLI_EXPERIMENTS: webframeworks to enable the experiment.

3Verify your firebase.json configuration

Check your firebase.json to ensure it's properly configured for framework deployment:

Framework-aware configuration (requires webframeworks experiment):

json
{
  "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):

json
{
  "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:

json
{
  "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:

bash
firebase deploy --only hosting:nextjs-app

Common 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

4Initialize Firebase Hosting with framework support

If you're setting up a new project or need to reconfigure, properly initialize Firebase Hosting:

Initialize Firebase in your project:

bash
# Enable webframeworks first
firebase experiments:enable webframeworks

# Initialize Firebase
firebase init hosting

During 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:

bash
# 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 automatically

For Angular projects:

bash
# 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 prompted

Manual framework configuration:
If auto-detection fails, you can manually configure in firebase.json:

json
{
  "hosting": {
    "source": ".",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "frameworksBackend": {
      "region": "us-central1",
      "maxInstances": 100,
      "minInstances": 0,
      "concurrency": 80
    }
  }
}

Verify framework detection:

bash
firebase deploy --only hosting --debug

Look for lines indicating framework detection:

bash
[debug] Detected Next.js framework
[debug] Building Next.js application...
5Consider migrating to Firebase App Hosting (GA)

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:

bash
firebase init apphosting

Key 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

6Troubleshoot common deployment issues

If enabling the experiment doesn't resolve the issue, try these troubleshooting steps:

1. Clear Firebase cache and retry:

bash
# 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 hosting

2. Check for conflicting Firebase CLI installations:

bash
# 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 webframeworks

3. 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:

bash
# Deploy with verbose logging
firebase deploy --only hosting --debug

Look for quota errors or function deployment failures.

5. Test with a simple framework app:
Create a minimal test project to isolate the issue:

bash
# 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 hosting

If 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:

bash
firebase deploy --only hosting --debug 2>&1 | tee deploy.log

Review deploy.log for specific error messages or stack traces.

Advanced notes

### 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:

markdown
## 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:

bash
#!/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:

bash
cp firebase.json firebase.json.backup

2. 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:

json
{
  "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

Frequently asked questions

What does "Hosting: Cannot deploy web framework from source - experiment not enab" mean?
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.
How do I fix "Hosting: Cannot deploy web framework from source - experiment not enab"?
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.
What causes "Hosting: Cannot deploy web framework from source - experiment not enab"?
The webframeworks experiment is not enabled in Firebase CLI (most common) Using firebase.json with 'source' field without enabling the experimental feature CI/CD environment has a different Firebase CLI configuration than local development
Is the "Hosting: Cannot deploy web framework from source - experiment not enab" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading