stripe-firebase-extensions icon indicating copy to clipboard operation
stripe-firebase-extensions copied to clipboard

Redirecting to the checkout page is very slow.

Open yoshi-pi opened this issue 2 years ago • 6 comments

Bug report

  • Run Payments with Stripe

Describe the bug

When a user is redirected to the checkout page to start a subscription, it takes about 30 seconds. Most of the time is spent waiting for onSnapshot callback.

To Reproduce

console.log('addDoc(): ', new Date().toJSON());
const docRef = await db
  .collection('customers')
  .doc(currentUser.uid)
  .collection('checkout_sessions')
  .add({
    price: 'price_(myPriceID)',
    success_url: window.location.origin,
    cancel_url: window.location.origin,
  });
console.log('onSnapshot(): ', new Date().toJSON());
docRef.onSnapshot((snap) => {
  console.log('snapshot callback: ', new Date().toJSON(), snap.data());
  const { error, url } = snap.data();
  if (url) {
    // We have a Stripe Checkout URL, let's redirect.
    window.location.assign(url);
  }
});

Result

addDoc(): 2023-02-20T16:36:29.717Z onSnapshot(): 2023-02-20T16:36:30.372Z snapshot callback: 2023-02-20T16:36:30.590Z { price: '...', success_url: '...', cancel_url: '...'} snapshot callback: 2023-02-20T16:36:58.847Z { price: '...', success_url: '...', cancel_url: '...', url: '...', sessionId: '...', mode: '...', created: {...}, client: '...'}

Expected behavior

I want to redirect users more quickly.

Screenshots

Logs of Cloud Functions and Firestore.

Screenshot 2023-02-21 at 2 24 30

System information

  • OS: macOS
  • Browser: Chrome

Additional context

・This issue occurs when a user has not been redirected to the checkout page for 2-3 days. ・This issue is a bit similar to #68.

yoshi-pi avatar Feb 20 '23 17:02 yoshi-pi

Seeing the same, even with a minimum instances provisioned (should keep warm??)

arepp23 avatar Mar 26 '23 03:03 arepp23

Experiencing the same issue.

JEndler avatar Jun 28 '23 12:06 JEndler

Same here, it is incredibly slow.

Hibrix-net avatar Sep 19 '23 15:09 Hibrix-net

Has anyone had any luck solving this? I have a minimum instance and its still taking like 30 seconds..

allancorrigall avatar Apr 14 '24 04:04 allancorrigall

Has anyone had any luck solving this? I have a minimum instance and its still taking like 30 seconds..

Same to me. Could you please someone provide a solution for that?

Thanks,

Hibrix-net avatar Apr 14 '24 13:04 Hibrix-net

Same here. Has anyone managed to resolve this issue ?

desk-pro avatar Jul 22 '24 13:07 desk-pro