#mrcsj
1 messages · Page 1 of 1 (latest)
Hi there, do you have the error message?
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)
Ok do you know at which line of the error this error is thrown from?
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)
Can you scroll down the trace and see if your code is there?
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
Ok, so this exception happens when you call PaymentMethod.retrieve ?
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.
Is your Stripe API version 2020-08-27 ?
Can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details
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.
From Dashboard I can see that you are using other API versions as well. https://dashboard.stripe.com/developers
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Do you log API version that you code uses when this exception happens?
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
Thanks for waiting, discord is busy today
Do you have a request ID of the payment method retrieval that encountered this exception?
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
Or do you have the timestamp so that we can check the log?
Is it UTC?
this is the timestamp for the case and the metadata is 49288845828448665664
And on which account? because you shared 3 account IDs
Sep 22, 2023 @ 10:42:45.934 UTC + 8
for account id : acct_1GGgEQCX9m5etkmR
I don't see any GET request related to pm_1MwMETCX9m5etkmRlgpBQ2yb in your logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
There's only one POST request
yeah so that's a problem
in our backend we really a retrive request for this pmid
and it's response cause the npe
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?
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
I'd suggest you to work with your backend engineer to check your server log and find out more about this request.
i am the backend engineer
OK, did you check you server log? What's the HTTP response code? any error?
we use the Stripe's sdk So we didn't log the http response code.
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?
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.
Hmm. So what server are you running in production? is it apache?
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
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
Hmm, my understanding of access log it keeps tracks of all network activities happening in your server, including requests made by using Stripe SDK
I'd suggest you to enable the access log and debug log in your server, so that you can find out more information
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?
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
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
but the log i found was success in your dashboard
https://dashboard.stripe.com/logs/req_7MSKkeCUPfKceu
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
👋 Taking over this thread, looking into it now
Are you able to reproduce the same issue in the test mode?
no. it only happens by accident
This is strange. Did you configure any timeout in stripe-java: https://github.com/stripe/stripe-java/tree/master#configuring-timeouts ?
connectTimeout = 10000
readTimeout = 30000
but i didn't think it's a timeout problem
you can see this stack trace
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?
Yup, I understand. It'll be helpful to include the stripe-java version in the email as well