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

Testing Firebase second generation #78

Open
wants to merge 2 commits into
base: firebase
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- run: pnpm install
- run: pnpm build
env:
NITRO_PRESET: firebase
NITRO_PRESET: "./firebase-second-gen-preset"
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
20 changes: 20 additions & 0 deletions firebase-second-gen-preset/entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import "#internal/nitro/virtual/polyfill";
import { type HttpsOptions, onRequest } from "firebase-functions/v2/https";

// auto imported
// import { toNodeListener } from 'h3'

const nitroApp = useNitroApp();

const onRequestDefaults = {
memory: "1GiB",
} satisfies HttpsOptions;

export const serverSecondGen = onRequest(
{
...onRequestDefaults,
// must be enforced for google cloud permissions to be set correctly
invoker: "public",
},
toNodeListener(nitroApp.h3App)
);
7 changes: 7 additions & 0 deletions firebase-second-gen-preset/nitro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { fileURLToPath } from "node:url";
import type { NitroPreset } from "nitropack";

export default {
extends: "firebase",
entry: fileURLToPath(new URL("entry.ts", import.meta.url)),
} satisfies NitroPreset;
5 changes: 3 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"functions": {
"source": ".output/server"
"source": ".output/server",
"runtime": "nodejs18"
},
"hosting": [
{
Expand All @@ -10,7 +11,7 @@
"rewrites": [
{
"source": "**",
"function": "server"
"function": "serverSecondGen"
}
]
}
Expand Down
Loading