Skip to content

Conversation

mariohd
Copy link
Contributor

@mariohd mariohd commented Aug 4, 2025

Problem

"message": "undefined method 'code' for an instance of BaseService::ThirdPartyFailure",
 "backtrace": [
       "/app/app/graphql/concerns/execution_error_responder.rb:85:in 'ExecutionErrorResponder#result_error'",
       "/app/app/graphql/mutations/invoices/generate_payment_url.rb:23:in 'Mutations::Invoices::GeneratePaymentUrl#resolve'",

::Invoices::Payments::GeneratePaymentUrlService.call(invoice:) can result in a result.third_party_failure!.

https://github.com/getlago/lago-api/blob/main/app/services/invoices/payments/stripe_service.rb#L68

Stacktrace

https://github.com/getlago/lago-api/blob/main/app/graphql/mutations/invoices/generate_payment_url.rb
https://github.com/getlago/lago-api/blob/main/app/services/invoices/payments/generate_payment_url_service.rb#L35
https://github.com/getlago/lago-api/blob/main/app/services/payment_intents/fetch_service.rb#L19-L21
https://github.com/getlago/lago-api/blob/main/app/services/invoices/payments/stripe_service.rb#L55-L69

Fix

Respond BaseService::ThirdPartyFailure correctly at ExecutionErrorResponder

when BaseService::ThirdPartyFailure
third_party_failure(messages: service_result.error.message)

@mariohd mariohd requested a review from ivannovosad August 4, 2025 17:22
@mariohd mariohd force-pushed the allow-generate-payment-url-fail branch from 0b0500f to 675cecc Compare August 4, 2025 18:31
Copy link
Contributor

@ivannovosad ivannovosad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
I created a PR on top of yours that adds specs

Add specs for ExecutionErrorResponder
@mariohd mariohd merged commit fa3a4b1 into main Aug 5, 2025
14 checks passed
@mariohd mariohd deleted the allow-generate-payment-url-fail branch August 5, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants