Login only works on second try, and never in mobile safari

I am very certain it is not really a Vaadin/Hilla bug per se, but me misusing it somehow. But I have tried everything i can think of, and just hopes someone has a clue of where to look.

The first time I log in, everything looks good on the server(to my knowledge and logging). But I get this error in the client:
{error: true, errorMessage: ‘Failed to fetch’, errorTitle: ‘TypeError’}
I can not find anything useful in the network tab.

The second time it works as expected on all desktops and on mobile android and in different browsers. But on mobile IOS, it never succeeds to login in neither Safari nor Chrome.

So two bugs in one post here: Why the h*ll cant I log in the first time, and why can I never log in on an iPhone?

Anyone smarter than me that can tell me of where to start look?

I have switched between Tomcat and Jetty, and different versions of them.
I have changed ThreadPool between standard and virtual threads.

I am running JWT login in stateless mode after the guide from Matti.
I am using the login method in hilla-frontend/Authentication.d.ts

Running Java 21
Running Vaadin 24.4.4

Hi @whiteancient,
Could you please provide a repo with your code or some steps to reproduce the behaviour you described? Thank you.

1 Like

This being a very weird corner case, it would be very helpful to see your repo, instead of making wild guesses. Is it possible to share a repo that can reproduce this issue?

12 hours of development later: I did solve the “Second try” problem by changing the name of the hilla-path for login to something else than “login”. The problem seemed to be a race condition between a request for GET:login and a POST:login that both hit the server at the same time. If the GET was answered faster than the POST, the login failed. Which it usually did on the first try, but not the second.

I hope to get access to an iPhone beginning of next week to be able to fix the second problem as well, since I am completely lost by why that problem exists.

The login page is actually up and running here: BTTLGRND. (testtest@bttlgrnd.com / testtest) The whole site is in a repo of course, but I believe it is something I have misconfigured among all the strange stuff I have done, so creating a sample with the same problem I suppose is quite hard. I was just after if someone has experienced the same thing and had found a problem to this strange behaviour.