#mrcsj

1 messages · Page 1 of 1 (latest)

static spokeBOT
cyan belfry
#

Hi there, do you have the error message?

signal hollow
#

java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at com.stripe.net.AbstractStripeResponse.<init>(AbstractStripeResponse.java:78)
at com.stripe.net.StripeResponseStream.<init>(StripeResponseStream.java:17)

cyan belfry
#

And what's the relevant code?

#

Are you using the latest version of Stripe Java SDK?

signal hollow
#

not the latest version

#

20.129.0

cyan belfry
#

Ok do you know at which line of the error this error is thrown from?

signal hollow
#

java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at com.stripe.net.AbstractStripeResponse.<init>(AbstractStripeResponse.java:78)
at com.stripe.net.StripeResponseStream.<init>(StripeResponseStream.java:17)
at com.stripe.net.HttpURLConnectionClient.requestStream(HttpURLConnectionClient.java:45)
at com.stripe.net.HttpURLConnectionClient.request(HttpURLConnectionClient.java:68)
at com.stripe.net.HttpClient.sendWithTelemetry(HttpClient.java:66)
at com.stripe.net.HttpClient.requestWithTelemetry(HttpClient.java:83)
at com.stripe.net.HttpClient.lambda$requestWithRetries$0(HttpClient.java:145)
at com.stripe.net.HttpClient.sendWithRetries(HttpClient.java:109)
at com.stripe.net.HttpClient.requestWithRetries(HttpClient.java:145)
at com.stripe.net.LiveStripeResponseGetter.request(LiveStripeResponseGetter.java:58)
at com.stripe.net.ApiResource.request(ApiResource.java:181)
at com.stripe.model.PaymentMethod.retrieve(PaymentMethod.java:291)
at com.stripe.model.PaymentMethod.retrieve(PaymentMethod.java:263)

cyan belfry
#

Can you scroll down the trace and see if your code is there?

signal hollow
#

okay i just cut my code off and only give you the stack of your sdk code

#

as you see the root cause in your sdk code is PaymentMethod.java:263

cyan belfry
#

Ok, so this exception happens when you call PaymentMethod.retrieve ?

signal hollow
#

yeah

#

but there also have the same npe in some other methods(such as PaymentIntent.create)

#

and this npe has never happend in the passed days.

#

and it become more and more frequently those days.

cyan belfry
#

Is your Stripe API version 2020-08-27 ?

signal hollow
#

wait a minute. i will check version again

#

yes it's is 2020-08-27

cyan belfry
#

Can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details

signal hollow
#

okay wait a moment

#

acct_1GGgEQCX9m5etkmR

#

and we also have sub merchant account.
my. acct_1GGgEQCX9m5etkmR
sg acct_1FWhrIEbzXWqQrHh

#

the npe exception happens in both of them.

cyan belfry
#

Do you log API version that you code uses when this exception happens?

signal hollow
#

no. i didn't log the api version .But we only import the one sdk version (api 'com.stripe:stripe-java:20.129.0')

#

and the Stripe code in sdk it shows api_version is 2020-08-27

#

and you can see this picture

cyan belfry
#

Thanks for waiting, discord is busy today

#

Do you have a request ID of the payment method retrieval that encountered this exception?

signal hollow
#

sorry we didn't log the request id. in normal case the request id will print if your sdk can parse the response from your server.

#

the problem is that the SDK can't parse the response from your server

#

so we didn't get the request id

cyan belfry
#

Or do you have the timestamp so that we can check the log?

signal hollow
#

yeah

#

Sep 22, 2023 @ 10:42:45.934

cyan belfry
#

Is it UTC?

signal hollow
#

this is the timestamp for the case and the metadata is 49288845828448665664

cyan belfry
#

And on which account? because you shared 3 account IDs

signal hollow
cyan belfry
#

Test mode or live mode?

#

And what's the PaymentMethod ID?

signal hollow
#

live mode

#

pm_1MwMETCX9m5etkmRlgpBQ2yb

cyan belfry
#

I don't see any GET request related to pm_1MwMETCX9m5etkmRlgpBQ2yb in your logs

#

There's only one POST request

signal hollow
#

yeah so that's a problem

#

in our backend we really a retrive request for this pmid

#

and it's response cause the npe

cyan belfry
#

If there's no log at Stripe, it means the API request wasn't successful.

Have you checked your network and see if there's anything that prevent your request reaching to Stripe API endpoint?

signal hollow
#

most of the stripe api endpoint it works well

#

only some of them has npe happens

#

we have nothing to limit the request to stripe api endpoint

cyan belfry
#

I'd suggest you to work with your backend engineer to check your server log and find out more about this request.

signal hollow
#

i am the backend engineer

cyan belfry
#

OK, did you check you server log? What's the HTTP response code? any error?

signal hollow
#

we use the Stripe's sdk So we didn't log the http response code.

cyan belfry
#

I mean your server log. Your server must keep a log for all the requsts and responses

#

Maybe you want to work with your team mate to find the log?

signal hollow
#

there maybe a gap. our service -> (integration stripe sdk) -> stripe server. So all of the request to stripe log was wrapped by stripe sdk. we didn't log any detail about this.

cyan belfry
#

Hmm. So what server are you running in production? is it apache?

signal hollow
#

yes

#

a spring boot server

#

it Built-in Tomcat container

cyan belfry
#

OK, did you enable access logs in your spring server?

#

Check you server config file and see if you have something like server.tomcat.accesslog.enabled=true

signal hollow
#

sorry we didn't enable this

#

but the access log only record the request to our server.

#

And it didn't log the request from our server to stripe backend?

#

so maybe it's helpless in this problem

#

i want to know if there some config that i can log more detail in stripe sdk. so i can enable this to continue track this problem

cyan belfry
#

Hmm, my understanding of access log it keeps tracks of all network activities happening in your server, including requests made by using Stripe SDK

signal hollow
#

okay maybe i am wrong

#

i will check the access.log 's ability

cyan belfry
#

I'd suggest you to enable the access log and debug log in your server, so that you can find out more information

signal hollow
#

okay i will have a try

#

btw. i think maybe stripe's sdk can cover this problem and do not throw a npe . maybe a apiException?

#

i guess this problem was caused by unstable network.so sometimes it works well and sometimes it has exception happen.

#

can this topic stay pending for us to continue track this problem?

cyan belfry
#

I agree, you can try a newer version of the SDK and see if it throws APIException instead.

#

I can't keep a thread for a long time. If you come back and find your thread closed. You can ask again in #dev-help channel

signal hollow
#

we will have a vacation in 10oct. so this problem should be fix as soon as possible.

#

okay. thank you i will have try

#

wait a moment

#

i give you another info about this case

#

java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at com.stripe.net.AbstractStripeResponse.<init>(AbstractStripeResponse.java:78)
at com.stripe.net.StripeResponseStream.<init>(StripeResponseStream.java:17)
at com.stripe.net.HttpURLConnectionClient.requestStream(HttpURLConnectionClient.java:45)
at com.stripe.net.HttpURLConnectionClient.request(HttpURLConnectionClient.java:68)
at com.stripe.net.HttpClient.sendWithTelemetry(HttpClient.java:66)
at com.stripe.net.HttpClient.requestWithTelemetry(HttpClient.java:83)
at com.stripe.net.HttpClient.lambda$requestWithRetries$0(HttpClient.java:145)
at com.stripe.net.HttpClient.sendWithRetries(HttpClient.java:109)
at com.stripe.net.HttpClient.requestWithRetries(HttpClient.java:145)
at com.stripe.net.LiveStripeResponseGetter.request(LiveStripeResponseGetter.java:58)
at com.stripe.net.ApiResource.request(ApiResource.java:181)
at com.stripe.model.PaymentIntent.create(PaymentIntent.java:532)

#

the exception occurred when PaymentIntent.create

static spokeBOT
lost folio
#

👋 Taking over this thread, looking into it now

#

Are you able to reproduce the same issue in the test mode?

signal hollow
#

no. it only happens by accident

lost folio
signal hollow
#

connectTimeout = 10000
readTimeout = 30000

#

but i didn't think it's a timeout problem

signal hollow
lost folio
#

Based on your config, it's not a timeout problem. I'm afraid I'm unable to identify why NullException is thrown in your SDK. Based on req_7MSKkeCUPfKceu logs at our end, everything was fine. Can I suggest you writing to our Support with the error and example request, so that we can check with relevant team?

signal hollow
#

yeah of course.

#

btw the sdk is from stripe.

#

i just use this

lost folio
#

Yup, I understand. It'll be helpful to include the stripe-java version in the email as well