Skip to content

The extension is abandonedย #651

@androng

Description

@androng

These things I have had to learn through personal experience in the last few months. As of 2025-01-18 they are still valid and none of the fixes are in the main branch yet, only in pull requests.

  1. There has been no commit history for over a year
  2. The extension still runs on NodeJS 14 which will be decomissioned by Google on 2025-01-30.
    Image
    Solution is to change this line to "node": "20"
  3. The extension only work on production. it references "emulator" in the repo a couple times but It has problems running on Firebase emulator. (detailed later) . no-work solution is to not use the emulator and just use a in-cloud staging environment but my entire workflow was already on the emulator so I ended up fixing the problems.
  4. createCheckoutSession just did not work on emulator OR production, fixed with FirebaseError on createCheckoutSessionย #304
  5. There is no support for adding a Stripe test key and test webhook secret so I added it myself
 export default {
-  stripeSecretKey: process.env.STRIPE_API_KEY,
-  stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
+  stripeSecretKey: process.env.FUNCTIONS_EMULATOR 
+    ? process.env.STRIPE_API_KEY_EMULATOR    // Use test key in emulator
+    : process.env.STRIPE_API_KEY_PROD,   // Use production key in production
+  stripeWebhookSecret: process.env.FUNCTIONS_EMULATOR
+    ? process.env.STRIPE_WEBHOOK_SECRET_EMULATOR
+    : process.env.STRIPE_WEBHOOK_SECRET_PROD,
   productsCollectionPath: process.env.PRODUCTS_COLLECTION,
   customersCollectionPath: process.env.CUSTOMERS_COLLECTION,
   stripeConfigCollectionPath: process.env.STRIPE_CONFIG_COLLECTION,
  1. The webhook just does not run on the Firebase emulator unless you change this in index.ts
    src/config.ts
-export const handleWebhookEvents = functions.handler.https.onRequest(
+export const handleWebhookEvents = functions.https.onRequest(
  1. I had trouble because I used the name "stripe_customers" instead of "customers" Firestore collection name. The extension asks you if you want to rename it but then it doesn't work. I had to hardcode the name to "stripe_customers" in the code. or just use the default names but then they're not grouped together in Firestore
  2. There is no webhook support for handling the "refund" event at all, this is personally important to me because I want refunds from Stripe Dashboard to reflect in my app so users are not encouraged to "double spend" ie get a refund and use my app anyway. Apparently this is fixed with feat(firestore-stripe-payments): Update payments collection for refundsย #650
  3. There is no support for Stripe one-time-purchases (pre-pay) or pay-as-you-go (post-paid) purchases. pretty much its Stripe subscription only. I wanted pre-paid or post-paid so not having that is annoying.

Since the developers are not responding at all, i just uninstalled the extension but integrated all the Typescript files into my main project. either that or it doesn't work at all.
in retrospect I am not sure which is less work:

  • just not using the extension at all and checking Stripe every time instead of Firestore. My app is not latency sensitive and I realized I only really just need to link Firestore users to Stripe and I don't care about dynamically updating prices and products. I could have just checked Stripe for that instead of Firestore.
  • write from scratch just the few webbook events I needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions