Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thepassle/astro-firebase
https://github.com/thepassle/astro-firebase
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/thepassle/astro-firebase
- Owner: thepassle
- Created: 2022-04-28T08:24:21.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-05T13:10:13.000Z (over 2 years ago)
- Last Synced: 2024-09-30T10:41:32.507Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://astro-firebase.web.app/
- Size: 138 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-astro - Astro Firebase - Deploy your server-side rendered (SSR) Astro app to Firebase (Astro Integrations)
README
# astro-firebase
> [[demo]](https://astro-firebase.web.app/), [[source]](https://github.com/thepassle/astro-firebase-demo)
Deploy your server-side rendered (SSR) Astro app to [Firebase](https://firebase.google.com/).
Use this adapter in your Astro configuration file, alongside a valid deployment URL:
```js
import { defineConfig } from 'astro/config';
import firebase from 'astro-firebase';export default defineConfig({
adapter: firebase(),
});
```After you build your site the `functions/` folder will contain your [Firebase Function](https://firebase.google.com/docs/functions) that runs Astro.
Now you can deploy!
```shell
firebase deploy
```## Configuration
### packageJson
Firebase Functions requires your `functions/` folder to contain a `package.json`. We create a default `package.json` based on the `package.json` in your root. If you want to override some options, like for example the node version that Firebase should use, you can configure the `packageJson` property.
```js
import { defineConfig } from 'astro/config';
import firebase from 'astro-firebase';export default defineConfig({
adapter: firebase({
packageJson: {
engines: {
node: '18'
}
}
})
});
```## FAQ
### 403 `Error: Forbidden Your client does not have permission to get URL / from this server`
If you're getting a 403 after deploying your project, it could be the case that you have to change the permissions of your Firebase Function. You can do this by following these steps:
- Go to your [Firebase Console](https://console.firebase.google.com/)
- Select your firebase project
- Select `Functions` in the menu on the left
- Hover over your `handler` function in the Functions list in the `Dashboard`, a three-dotted menu button should appear, click it
- Click `Detailed usage stats`, this will take you to Google Cloud Platform
- Click the `permissions` tab
- Click `+ ADD`
- in the `New principals` field, enter: `"allUsers"`
- in the `Select a role` menu, enter: `Cloud Functions` -> `Cloud Functions Invoker`
- ✅ DoneYou should now be able to view your app.