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

Support Astro hybrid rendering #5898

Merged
merged 5 commits into from
Jun 1, 2023
Merged

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented May 25, 2023

Give Astro hybrid rendering a spin npm i -g github:firebase/firebase-tools#jamesdaniels_astroHybridSupport

firebase init hosting and firebase deploy from your Astro app.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 75.00% and project coverage change: +55.03 🎉

Comparison is base (51d2fd5) 0.00% compared to head (3f5dca9) 55.03%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5898       +/-   ##
===========================================
+ Coverage        0   55.03%   +55.03%     
===========================================
  Files           0      333      +333     
  Lines           0    22960    +22960     
  Branches        0     4708     +4708     
===========================================
+ Hits            0    12636    +12636     
- Misses          0     9196     +9196     
- Partials        0     1128     +1128     
Impacted Files Coverage Δ
src/frameworks/astro/index.ts 85.10% <75.00%> (ø)

... and 332 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Snugug
Copy link

Snugug commented May 26, 2023

Thanks for working on this! I'm testing it out using firebase emulators:start and it's rendering the site from the server, which is great, but it's also not using the pre-rendered pages as I'd expect. Is there additional config I need to get prerendering to work under emulators?

@jamesdaniels
Copy link
Member Author

@Snugug by default we use fast dev-mode (HMR) for emulators:start. To emulate behavior closest to production use FIREBASE_FRAMEWORKS_BUILD_TARGET=production firebase emulators:start

@Snugug
Copy link

Snugug commented May 26, 2023

@Snugug by default we use fast dev-mode (HMR) for emulators:start. To emulate behavior closest to production use FIREBASE_FRAMEWORKS_BUILD_TARGET=production firebase emulators:start

Thanks! This got the static site running as expected, but routes I expect the server to handle aren't working. I get a blank white page with the following error:

Function us-central1-ssr{{project}} does not exist, valid functions are:

{{project}} is my project name. There are no valid functions listed. Is there other config that's missing?

@austincrim
Copy link
Contributor

@jamesdaniels lgtm.

@Snugug I was able to run locally and deploy using the Astro starter project with the following astro.config.mjs:

import { defineConfig } from 'astro/config'

import node from '@astrojs/node'

// https://astro.build/config
export default defineConfig({
  output: 'hybrid',
  adapter: node({
    mode: 'middleware'
  }),
  experimental: {
    hybridOutput: true
  }
})

I added export const prerender = false to one of my .astro files and then ran FIREBASE_FRAMEWORKS_BUILD_TARGET=production firebase emulators:start with the version of firebase-tools that James specified in the original post.

@jamesdaniels
Copy link
Member Author

jamesdaniels commented Jun 1, 2023

@Snugug maybe your issue is the same as #5880? Are you using aliases?

@jamesdaniels jamesdaniels enabled auto-merge (squash) June 1, 2023 15:45
@jamesdaniels jamesdaniels merged commit 3b80ee2 into master Jun 1, 2023
31 checks passed
@Snugug
Copy link

Snugug commented Jun 2, 2023

@Snugug maybe your issue is the same as #5880? Are you using aliases?

I am not; only have default in .firebaserc and can confirm this is still an issue with the latest version

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

Successfully merging this pull request may close these issues.

None yet

4 participants