Comments (11)
Does this error still persist for you with the newly added changes?
Also, did that just occur on Windows machines or could you experience the same issue on a different platform as well?
from fiskaly-kassensichv-client-java.
It feels like it happens less often right now, yet it still occurs in like 50% of the transactions. I haven't experienced this problem on MacOS.
from fiskaly-kassensichv-client-java.
I've tried to reproduce your error but failed unfortunately. This was the setup I've used:
OS: Windows 10
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
I've got some suspicions what could be causing the issue though:
- Are the environment variables
API_SECRET
andAPI_KEY
set and valid? Otherwise the client will fail with the error you've received. - Is it possible that the Windows machine sits behind a proxy that manipulates HTTP-Headers?
from fiskaly-kassensichv-client-java.
When I retry the transaction it works (sometimes). So it's not a general problem, but in some occasions. Maybe I have to notice that we do all requests via a "persistent" Java app / server, so the app is started once and then handles all request to fiskaly. We also only create the GeneralSMA object once (per server app start) and use it for all following requests. It that the valid type of use or should we create an instance of the GeneralSMA for every request again?
Nevertheless the exception sometimes already occurs at the first transaction after the server start (so with a "fresh" GeneralSMA object).
I could also implement an automatic retry if the exception is thrown. Today I'm not in the office, but I will report and then we can see if we can narrow down the problem.
from fiskaly-kassensichv-client-java.
Ok, so we tested it again. It happens randomly, but with 50% chance. I also tested to use a new instance of GeneralSMA for every request but that didn't work either, same behaviour.
Now we have implemented an automatic retry when this exception is thrown, so there is no impact anymore on our application. Nevertheless it's a weird thing.
from fiskaly-kassensichv-client-java.
That's especially weird because such a mechanism already exists. Are you sure you're using the latest version of the project?
You shouldn't need to create a new SMA instance for every request, one is sufficient.
from fiskaly-kassensichv-client-java.
Yes, we are up to date on master branch of the client. Yet I don't think that this issue is related to the 401 status when credentials are expired. This works as expected. The "Too many follow-up requests" is thrown when there are valid credentials given but some other things happening.
from fiskaly-kassensichv-client-java.
I have the same issue on Android, it happens randomly:
java.net.ProtocolException: Too many follow-up requests: 21
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:122)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at com.fiskaly.kassensichv.client.interceptors.TransactionInterceptor.intercept(TransactionInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at com.fiskaly.kassensichv.client.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:49)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at com.fiskaly.kassensichv.client.interceptors.HeaderInterceptor.intercept(HeaderInterceptor.java:23)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
at okhttp3.RealCall.execute(RealCall.kt:66)
private static final String API = "https://kassensichv.io/api/v0";
private static final ObjectMapper objectMapper = new ObjectMapper();
private static final OkHttpClient okHttpClient = ClientFactory.getClient(Fiskaly.PUBLISHABLE_KEY, Fiskaly.SECRET_KEY, new AndroidSMA());
private static void _createTss(final Context context) {
try {
// Request
Map<String, String> body = new HashMap<>();
body.put("state", "INITIALIZED");
body.put("description", "test");
Request request = new Request.Builder()
.url(Fiskaly.API + "/tss/" + UUID.randomUUID())
.put(RequestBody.create(Fiskaly.objectMapper.writeValueAsString(body), MediaType.parse("application/json")))
.build();
// Response
String response = Fiskaly.okHttpClient.newCall(request).execute().body().string();
Log.i("APP_FISKALY", "TTS - " + response);
} catch (Exception exception) {
exception.printStackTrace();
}
}
I think it may come from the authentication.
from fiskaly-kassensichv-client-java.
Failed authentication will cause this behaviour. Did you verify that your credentials are valid for that example?
Regarding "it happens randomly": Does this means it works for some time but some requests randomly fail? If so, did you notice a particular group (e.g. targeting a specific resource) or type of requests failing or does that happen arbitrarily?
from fiskaly-kassensichv-client-java.
I will try to collect more data the next time it happens.
from fiskaly-kassensichv-client-java.
This should be fixed with #30 .
I will close this issue for now but if, by any reason, this should happen again please just reopen the issue and come back to me.
from fiskaly-kassensichv-client-java.
Related Issues (16)
- TokenManager: wrong call of RequestBody.create HOT 2
- Exception on Android: com/fiskaly/kassensichv/sma/Sma HOT 4
- Update a transaction: querystring.last_revision should be integer HOT 6
- Size optimization HOT 2
- Crash when creating a transaction on a Samsung S4 & S5 HOT 8
- Missing com.fiskaly.kassensichv.client.android-<version>.jar for Android HOT 9
- Error compiling the project: Duplicate classes HOT 9
- Error on build HOT 1
- Empty certificate serial when I retrieve a transaction HOT 5
- Proguard rules HOT 4
- Impossible to generate a signed Bundle with Android Studio HOT 4
- Missing "x86" os.arch handling
- SmaLoader: On MacOS wrong libPath HOT 2
- SmaLoader: set different path for library HOT 4
- 404 when trying to finish transactions through SMA HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fiskaly-kassensichv-client-java.