question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🆕 Firebase Integrations (Codebases, deploy)

See original GitHub issue

Describe the problem

Firebase have recently added features which will impact the development of this Adapter.

1: codebases - allow the configuration of multiple folders of functions. This would be useful to separate out the Cloud Function used for SSR from the rest of your codebases functions.

2: firebase deploy - is using some other mechanism referred to as “Firebase Frameworks” to allow the deploy command to know how to build and deploy SSR applications from meta-frameworks like Next.js etc. Next.js & Angular are currently supported.

Describe the proposed solution

I need to experiment with how these features work and might impact this adapter.

Given there was no closed-alpha or beta of these features (that I am aware of, I am part of the alpha and active in this space but never heard anything), I wouldn’t be surprised if the Firebase team implemented their own SvelteKit integration with the new firebase deploy feature.

Depending on the boundaries of the firebase deploy feature, the adapter may still be required.

If this adapter is still required, I am thinking that Codebases gives a nice boundary for us to separate out the Cloud Function for SSR from the rest of peoples apps, which means pre-deployment compilation is easier, as is support for TypeScript.

With Codebases being a user-land feature I propose we implement that now, regardless of the firebase deploy status, and we can at least simplify the usage of the current adapter.

Alternatives considered

NA

Importance

would make my life easier

EDIT:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cdcarsoncommented, May 18, 2022

I’d vote for exposing an firebaseSsrOutputFolder in the adapter’s config, and ignore the functions property in firebase.json.

// svelte.config.js
/** @type {import('@sveltejs/kit').Config} */
const config = {
  
  kit: {
    adapter: firebase({
      firebaseSsrOutputFolder: 'functions-ssr'  
    }),
  }
};

If the option is passed, the adapter would overwrite (in this case) functions-ssr/lib safely, including the index.js that currently has to be modified by hand.

If the option is missing, then the adapter would output the code to the console, as it does now.

I think this would be the least confusing way to do it, at least for my simpler use case/firebase config. (Alternatives would be to specify the codebase name in the adapter config, or say that everyone has to use the same hardcoded codebase name.)

BTW, my current workaround is to copy firebase.json (which has the codebase array config) to firebase-ssr.json, removing the array and pointing source directly to the ssr folder. This works and deploys fine, but is obviously not ideal.

//firebase.json
"functions": [
  {
     "source": "functions",
     "codebase": "functions"
  },
  {
     "source": "functions-ssr",
      "codebase": "ssr"
   }
],
// firebase-ssr.json
"functions": {
  "source": "functions-ssr"
},
// svelte.config.js
/** @type {import('@sveltejs/kit').Config} */
const config = {
  
  kit: {
    adapter: firebase({
      firebaseJsonPath: 'firebase-ssr.json'
    }),

  }
};

Read more comments on GitHub >

github_iconTop Results From Across the Web

Organize multiple functions | Cloud Functions for Firebase
The codebase property can help simplify the management of multiple repositories. Let's examine a case where you have two different repositories that deploy...
Read more >
Issues · jthegedus/svelte-adapter-firebase
SvelteKit adapter for Firebase Hosting rewrites to Cloud Functions for a Svelte SSR experience - Issues ... 3 · 🆕 Firebase Integrations (Codebases,...
Read more >
Building Full stack webApp using JS + Flask + Postgres + ...
Deploy a complete web app using frontend in vanilla JS, backend in Flask framework, Postgres for backend database connections, firebase for ...
Read more >
Firebase
Deploy TTL policies to Firestore from the Firebase CLI You can now include ... a codebase to use different environments with Jetpack Compose...
Read more >
Remote Firebase + Senior Jobs with great benefits and pay
Senior Backend Engineer. 🎈 closed. Drops. This job is getting a high amount of applications right now (37% of viewers. Based in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found