razorpay / razorpay-woocommerce

Razorpay Payment Extension for Woocommerce
https://wordpress.org/plugins/woo-razorpay/
GNU General Public License v2.0
40 stars 30 forks source link

Uncaught Error Stack Trace #544

Open unakriti opened 8 months ago

unakriti commented 8 months ago

Hi,

My site has the Razorpay Plugin and the Razorpay Subscriptions Plugin with the folllowing software:

WordPress 6.4.3 Woocommerce version 8.6.1 Woocommerce subscription version 6.0.0 On the Checkout page, the Razorpay payment errors out. There are a few errors in the browser console too. There's also this fatal error on the site - it is related to your plugin. Here's the stack trace information for your attention please

WordPress version 6.4.3 Active theme: Bricks (version 1.9.6.1) Current plugin: 1 Razorpay: Signup for FREE PG (version 4.6.1) PHP version 8.2.15

Error Details An error of type E_ERROR was caused in line 142 of the file /wp-content/plugins/woo-razorpay/includes/razorpay-webhook.php. Error message: Uncaught Error: Call to a member function get_meta() on bool in /wp-content/plugins/woo-razorpay/includes/razorpay-webhook.php:142

Stack trace:

0 /wp-content/plugins/woo-razorpay/woo-razorpay.php(3008):

RZP_Webhook->process() https://github.com/razorpay/razorpay-woocommerce-subscriptions/pull/1 /wp-includes/class-wp-hook.php(324): razorpay_webhook_init() https://github.com/razorpay/razorpay-woocommerce-subscriptions/pull/2 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() https://github.com/razorpay/razorpay-woocommerce-subscriptions/pull/3 /wp-includes/plugin.php(517): WP_Hook->do_action() https://github.com/razorpay/razorpay-woocommerce-subscriptions/issues/4 /wp-admin/admin-post.php(61): do_action() https://github.com/razorpay/razorpay-woocommerce-subscriptions/pull/5 {main} thrown

Lastly, I receive the following webhooks failure notification email from Razorpay

"Hi, We have been experiencing webhook delivery failure for past 24 hours while trying to hit the live webhook url - https://www.domain.com/wp-admin/admin-post.php?action=rzp_wc_webhook. As noted in our documentation, we have disabled your webhook as a precaution. You can re-enable the webhook again by visiting the Dashboard and going to the webhooks tab."

If I manually point my browser to that webhook URL, it triggers the Uncaught Error mentioned above.

Please, can you help resolve these issues?

Kind regards,

yashgit891 commented 8 months ago

Hello @unakriti, Did you enable HPOS and then this error occurred? Also can you try saving the plugin settings once and let the webhook be automatically updated and check if the issue still persists..

abdulwahidsharief commented 8 months ago

@unakriti please check if woocommerce subscription plugin is active

unakriti commented 8 months ago

Thanks for your response.

@abdulwahidsharief Yes, the Woo Subscriptions plugin is active.

@yashgit891 to your questions

Screenshot 1: HPOS Configuration Woo HPOS Enabled Configuration Screenshot from 2024-03-18 18-03-34

Screenshot 2: Woo does not recognize Razorpay as a payment gateway capable of processsing automatic subscription payments Razorpay Woo Not Detected Screenshot from 2024-03-18 17-55-17

Look forward to your advise please.

Kind regards,

yashgit891 commented 8 months ago

@unakriti need to look into the message from Screenshot 2. Are there only subscription products in your store, or more specifically is the error that you mentioned above only occurring for subscription orders?

unakriti commented 8 months ago

@yashgit891 Thanks and yes, I only have Subscription products in the store - Simple Subscriptions and Grouped Products for Simple Subscriptions.

unakriti commented 8 months ago

Also, in test mode, while UPI works alright, the Netbanking option throws this error on the order page:

Screenshot: "Oops, something went wrong"

Razorpay Sanitized Error Screenshot from 2024-03-18 19-41-26

Kind regards,

yashgit891 commented 8 months ago

@unakriti the error that you have mentioned is related to plugins and we will start looking into it. As for the netbanking issue that needs to be reported to the support team by you as it is related to your account.

unakriti commented 8 months ago

@yashgit891 thank you so much. Sincerely appreciate it. I will raise the other issue of Netbanking error with Razorpay Support.

PS: Whlie with the plugin, might I request you to kindly consider the following?

At the moment, its not possible to use this Woo Subscription option of "Do not stop until cancelled" because Razorpay does not allow perpetual subscriptions. There are practical issues of managing a subscription with such a limitation. Therefore, could you please consider mapping Woo Subscirption's option of "Do not stop until cancelled" to Razorpay's maximum duration of 99 years? This request is also available here - https://github.com/razorpay/razorpay-woocommerce-subscriptions/issues/74

Kind regards,

yashgit891 commented 8 months ago

@unakriti sure we have noted this suggestion and once we have resolved the above issue, will look into this as well.

yashgit891 commented 8 months ago

Hello @unakriti, not able to reproduce the error at our end, are there any specific steps that are taken for this error to occur or is this happening for all orders?

unakriti commented 8 months ago

@yashgit891 thank you for your response. It's happening in general. I'm unable to place orders with either the test or live mode keys.

Regular products seem to work OK, but Simple Subscription or Grouped Products consisting of two or more Simple Subscription products run into such problems.

Kind regards,

On Tue, 19 Mar, 2024, 2:33 pm yashgit891, @.***> wrote:

Hello @unakriti https://github.com/unakriti, not able to reproduce the error at our end, are there any specific steps that are taken for this error to occur or is this happening for all orders?

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2006400052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3B4SMFWJQFVEPI4SIU7GTYY75NBAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGQYDAMBVGI . You are receiving this because you were mentioned.Message ID: @.***>

yashgit891 commented 8 months ago

@unakriti is it possible for you to come on a call with me so that I can check on you website only. If it is possible please email me your availability on yash.tripathi@razorpay.com and I will setup a call accordingly.

unakriti commented 8 months ago

Thank you for your helpful response and I've sent you an email.

Kind regards,

On Tue, 19 Mar, 2024, 3:22 pm yashgit891, @.***> wrote:

@unakriti https://github.com/unakriti is it possible for you to come on a call with me so that I can check on you website only. If it is possible please email me your availability on @.*** and I will setup a call accordingly.

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2006573619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3B4SNH4QLLADYGYU7Z6WDYZADFLAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGU3TGNRRHE . You are receiving this because you were mentioned.Message ID: @.***>

unakriti commented 8 months ago

Update: This is a pattern.

Razorpay sends a webhook request and it results in a fatal error described above. The site experiences a crash and sends a recovery email (including the stack trace).

After a few tries and recurring 500 status within a 24-hours window, Razorpay disables the webhook.

On Tue, 19 Mar, 2024, 3:22 pm yashgit891, @.***> wrote:

@unakriti https://github.com/unakriti is it possible for you to come on a call with me so that I can check on you website only. If it is possible please email me your availability on @.*** and I will setup a call accordingly.

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2006573619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3B4SNH4QLLADYGYU7Z6WDYZADFLAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGU3TGNRRHE . You are receiving this because you were mentioned.Message ID: @.***>

unakriti commented 8 months ago

Update: This is a pattern.

Razorpay sends a webhook request and it results in a fatal error described above. The site experiences a crash and sends a recovery email (including the stack trace).

After a few tries and recurring 500 status within a 24-hours window, Razorpay disables the webhook.

On Tue, 19 Mar, 2024, 3:38 pm Unakriti, @.***> wrote:

Thank you for your helpful response and I've sent you an email.

Kind regards,

On Tue, 19 Mar, 2024, 3:22 pm yashgit891, @.***> wrote:

@unakriti https://github.com/unakriti is it possible for you to come on a call with me so that I can check on you website only. If it is possible please email me your availability on @.*** and I will setup a call accordingly.

— Reply to this email directly, view it on GitHub < https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2006573619>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AN3B4SNH4QLLADYGYU7Z6WDYZADFLAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGU3TGNRRHE>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2006650391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3B4SN6KIGQVSVWGWI57RDYZAFATAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGY2TAMZZGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

unakriti commented 8 months ago

@yashgit891

Sincerely appreciate your support to resolve this issue with a modified plugin file made available via WeTransfer platform.

Might I request you to kindly create a dev branch for reference, here on Github? It helps to track the version I am using on my website.

Kind regards,

unakriti commented 8 months ago

@yashgit891

I thought everything was looking okay but there's this browser console error in the WordPress dashboard - it is related to the revised version (downloaded via WeTransfer) of this plugin. Could you advise how to resolve this please? Thanks

Razorpay Revised Plugin Console Error Screenshot from 2024-03-22 19-01-58

Kind regards,

unakriti commented 8 months ago

@yashgit891 Could you please help with the console error mentioned above?

yashgit891 commented 8 months ago

@unakriti looking into the error, but this error should not cause any issues with the normal flow of the plugin, as it is for analytics and not any functionality.

unakriti commented 8 months ago

@yashgit891 thank you so much for that clarification.

Also, could you please share a link to the dev branch of the plugin version shared via WeTransfer link?

yashgit891 commented 8 months ago

@unakriti this is the branch link but it does not have the changes for the conflict functionality that was removed as that error is not general. https://github.com/razorpay/razorpay-woocommerce/tree/subscription_events_fix

unakriti commented 8 months ago

@yashgit891 in that case, the next update to the plugin will overwrite the solution you have provided. What's a good way to resolve the issue?

yashgit891 commented 8 months ago

@unakriti the only possible way right now is to manually remove that piece of code at the time of update.

unakriti commented 8 months ago

@yashgit891

Sorry, cann't accept such a solution in production scenarios. Hope you will understand. Practically speaking, in this case, the plugin is broken even before we rollout the first update.

Could you please suggest a robust and stable solution that can survive future plugin updates without manual intervention?

Kind regards,

yashgit891 commented 8 months ago

@unakriti We cannot apply this change to our release as it will impact users that require the conflict functionality and it will hamper their flow. That is the only way it can be included in future releases.

unakriti commented 8 months ago

@yashgit891

I switched to Razorpay with much hope. Request you to please help integrate the scenarios to support all your merchants. Obviously, a manual update to the plugin is not a valid production-scenario - especially since I have a standard WooCommerce deployment.

Perhaps a conditional statement inside the plugin to include / exclude the conflict functionality might help resolve the issue?

Kind regards,

yashgit891 commented 8 months ago

@unakriti , To support this scenario, first we will need to reproduce the error and then proceed with the design and implementation of a viable solution, which might take some time. I will update on this thread when we have resolved this issue and released a version with the fix.

yashgit891 commented 8 months ago

@unakriti the branch that I have shared, is it causing any break in functionality, barring the 500 webhook error? Because even if few webhook requests are returning 500 response but there are 200 responses then flow should not break.

unakriti commented 8 months ago

@unakriti the branch that I have shared, is it causing any break in functionality, barring the 500 webhook error? Because even if few webhook requests are returning 500 response but there are 200 responses then flow should not break.

Subscription cancellation workflow breaks

@unakriti , To support this scenario, first we will need to reproduce the error and then proceed with the design and implementation of a viable solution, which might take some time. I will update on this thread when we have resolved this issue and released a version with the fix.

Thank you. Look forward to the new version update with a clean solution ready for production sites.

Kind regards,

yashgit891 commented 8 months ago

@unakriti subscription cancellation workflow has been fixed in that branch please test once more. And if still error is their share the error, as we have tested the same just now.

unakriti commented 8 months ago

@yashgit891

As requested, I tested again with the zip file downloaded from https://github.com/razorpay/razorpay-woocommerce/tree/subscription_events_fix. Hope this is correct?

This time WooCommerce did not detect the Razorpay Subscription plugin. Please see screenshot - it detects only the Razorpay Payment plugin.

Razorpay Subscription Plugin not Detected by Woo Screenshot from 2024-03-27 17-18-43

Edit: As expected, on the Checkout page, there's this message "Sorry, it seems there are no available payment methods which support subscriptions. Please contact us if you require assistance or wish to make alternate arrangements."

Kind regards,

yashgit891 commented 8 months ago

@unakriti can you rename the zip file to woo-razorpay.zip and check if Razorpay subscription option is there.

unakriti commented 8 months ago

I will test the file renaming and update here.

Meanwhile, I noticed that the zip file from WeTransfer is 1.2 MB whereas the GitHub zip is 588 kB - almost half the original file size. Is this difference okay - I hope I am using the correct file?

Kind regards,

yashgit891 commented 8 months ago

@unakriti it might be because of the way github compresses the file as compared to our systems. Also please rename the actual folder inside the zip file not just the zip file.

unakriti commented 8 months ago

Thanks for the clarification.

I renamed the folder and the zip file. However, when I upload and activate the plugin, it crashed my site (WordPress' white screen of death) whlie causing a conflict with the Litespeed Cache plugin (version 6.1). Error was caught at https://www dot domain dot com/wp-admin/plugins.php?action=activate&plugin=woo-razorpay%2Fwoo-razorpay.php&_wpnonce=448748t8ge

But if I then go to the plugins page and Activate the new Razorpay plugin, it works okay.

The webhook status for subscription.charged event and the subscription.cancelled event is 200 but the status of other webhook events shows as 409. Not sure whether the 409s will again force Razorpay to disable the webhook.

Kind regards,

yashgit891 commented 8 months ago

@unakriti no the 409s are expected and they will not cause any issues.Not sure of the first part though it maybe because of zip installation. Please observe if any errors occur in flow now.

unakriti commented 8 months ago

OK and so does this plugin version support automatic updates?

On Wed, 27 Mar, 2024, 6:39 pm yashgit891, @.***> wrote:

@unakriti https://github.com/unakriti no the 409s are expected and they will not cause any issues.Not sure of the first part though it maybe because of zip installation. Please observe if any errors occur in flow now.

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-woocommerce/issues/544#issuecomment-2022727249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3B4SOA4KPFFPPD62V7X3LY2LAIPAVCNFSM6AAAAABE2EUDSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRSG4ZDOMRUHE . You are receiving this because you were mentioned.Message ID: @.***>

yashgit891 commented 8 months ago

@unakriti yes this supports automatic updates.

unakriti commented 8 months ago

Many thanks for that confirmation.

Lastly, to fully support Woo Subscriptions, could you please consider the following features at the soonest possible:

  1. support for perpetual subscriptions (map to 99 years inside Razorpay) and
  2. Automatic renewal (renewal without requiring a customer login at the time of renewal)
  3. Support more than one product in the Woo cart if one of the products is a subscription

This should help many businesses to transition to Razorpay.

Kind regards,

unakriti commented 7 months ago

@yashgit891

The plugin makes the site unstable. The issue we discussed on this thread is persisting even after updating to the new version of the Razorpay plugin. The only other change is updating to WordPress to version 6.5. All else remains the same.

Here are the details as below:

WordPress has a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with one of your plugins, 1 Razorpay: Signup for FREE PG.

First, visit your website (https://www.domain.com/) and check for any visible issues. Next, visit the page where the error was caught (https://www.domain.com/wp-admin/admin-post.php?action=rzp_wc_webhook) and check for any visible issues.

Please contact your host for assistance with investigating this issue further.

If your site appears broken and you can't access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further.

https://www.domain.com/wp-login.php?action=enter_recovery_mode&rm_token=DE39vfLOUZD6hH16n8eVgH&rm_key=8tP3lpnDgGHIb8AOPPzQ4g

To keep your site safe, this link will expire in 1 day. Don't worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

When seeking help with this issue, you may be asked for some of the following information: WordPress version 6.5 Active theme: Bricks (version 1.9.7.1) Current plugin: 1 Razorpay: Signup for FREE PG (version 4.6.2) PHP version 8.2.15

Error Details

An error of type E_ERROR was caused in line 158 of the file /wp-content/plugins/woo-razorpay/includes/razorpay-webhook.php. Error message: Uncaught Error: Call to a member function get_meta() on bool in /wp-content/plugins/woo-razorpay/includes/razorpay-webhook.php:158

Stack trace:

0 /wp-content/plugins/woo-razorpay/woo-razorpay.php(3023): RZP_Webhook->process()

1 /wp-includes/class-wp-hook.php(324): razorpay_webhook_init()

2 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()

3 /wp-includes/plugin.php(517): WP_Hook->do_action()

4 /wp-admin/admin-post.php(61): do_action()

5 {main}

thrown

Kind regards,

yashgit891 commented 7 months ago

@unakriti can you try upgrading to the latest version that was released after I provided you the zip file and check.

unakriti commented 7 months ago

@yashgit891

Thank you . you'd notice from the error trace above, the plugin version is the latest - it was auto updated

Current plugin: 1 Razorpay: Signup for FREE PG (version 4.6.2)

Kind regards,

yashgit891 commented 7 months ago

@unakriti is wc_orders and wc_orders_meta table created for you in the database?

unakriti commented 7 months ago

@yashgit891 sorry for the delay to respond.

Yes, it is a standard WooCommerce deployment.

abdulwahidsharief commented 7 months ago

@unakriti can you please provide staging site access to abdul.sharief@razorpay.com

unakriti commented 7 months ago

@yashgit891 and @abdulwahidsharief

I've setup a staging version, verified that the issue has been reproduced for you to review and troubleshoot, and shared the admin access information with both of you via email.

Look forward to your help and guidance to resolve this please.

unakriti commented 7 months ago

@abdulwahidsharief

Hope the site access is now available and you are able to login and review the issue.

Look forward to read an update from you. Appreciate the support

Kind regards,

abdulwahidsharief commented 7 months ago

@unakriti placed a few orders but unable to reproduce the issue. i have added extra logs in plugins and uploaded them on site to debug please help us with logs when ever error occurs

unakriti commented 7 months ago

@abdulwahidsharief

Has there been a recent update to the Razorpay Subscriptions for WooCommerce plugin ? I noticed verion 2.3.9 on the staging site and also noticed "Added WC_Subscriptions_Cart check" note on the WP Repo. See screenshot below.

Woo RZP Subscription Plugin Updated to V239 Screenshot from 2024-04-15 19-52-42

With Razorpay Subscriptions for WooCommerce plugin version 2.3.9, I retried the transactions of placing and cancelling an order via my site. I did not notice any fatal errors in my site. Also, on the Razorpay dashboard, it took three 409 (http statuses) before seeing a 200 (green, OK) payment.authorized status. Overall the transactions went through without causing fatal errors / crashing my site.

The Razorpay Subscriptions for WooCommerce plugin version 2.3.9 is not available yet for auto-upgrade because on the WP Repo (as you'd notice above screenshot), it still says version 2.3.8. Perhaps it is an oversight?

Kind regards,

abdulwahidsharief commented 7 months ago

@unakriti 2.3.8 is version label which wasn't updated it will be fixed in next release. and 409 status is we are waiting for sometime for callback to execute first