-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage in react-native #24
Comments
Can you provide some more context? E.g. the arguments you're instantiating the class with, the args you're calling the method(s) with, as well as the routingjs version you're using :) |
sure ! node test :
==> works perfectly react-native test with some code instrumentation : yarn add @routingjs/valhalla
===> fail
|
Can you pass the @routingjs version as well? We just added improved error handling today (v0.1.0), so maybe that would at least help pinpointing the cause. But the fact that you're getting a |
It was updated already ;)
|
the client url should not have the last "/" no ?
|
Trailing slash should not be the issue here, but you can try manually using |
Since u are making request to the default url shouldn't there be an api key supplied to the constructor? |
The public Valhalla instance on OSM is open for anyone to use @Ananya2001-an , no key required |
Oh okay |
yes, no problem the the API Key. Valhalla really doesn't like the last "/" at the end of the API. in the Client.js, I replaced this :
by this :
and it works fine ! |
Okay then we've found it 😄 I can actually reproduce it locally using an Insomnia playground. @Ananya2001-an do you want to quickly draft a PR? |
Hm that’s an issue with the server as well right? A missing trailing slash shouldn’t cause a 404 |
Can confirm for locally running container using our Valhalla image as well though
gives me:
|
Yup I can do it. Just give me some time |
When I am testing locally and against the default URL there is no trailing slash being added to the url at the end so how come this |
This probably just has to do with differing behavior of the |
Okay... so then we can just replace it with a string |
There's a reason we use Actually, when I try it in my browser console, it doesn't add a trailing slash to a route that deviates from the base URL, so maybe this is specific to the platform @Koxx3 is using in this case? |
No issues we can do this :
So even if a trailing slash is added we still can rewrite the href prop to update it to the correct path before making the request. |
Aren’t we patching another software’s issue? Ideally a server would be robust to this IMHO. Even more ideally, client software shouldn’t just randomly add smth that alters the URL (it’s not the same URL, eg caching will behave differently). If it’s not the public server’s apache, then it’s prime_server or Valhalla (though for the public server it seems it’s a combination of both Apache and prime_server/valhalla?). Very strange that this never caused an issue before though.. Trailing slashes seem to be very controversial haha |
It seems that the reason this is suddenly an issue pertains to the platform that @Koxx3 is developing for (I'm not really familiar with React Native but I suppose you're using some kind of polyfill to be able to use the |
Yeah that's really weird behavior for a client lib (obviously not @Koxx3 fault). Still, a trailing slash can be added by people randomly (on purpose, by accident, out of habit), and I think we should fix this in prime_server. I'll ask Kevin, maybe he's open for that. |
Seems to be an old (and still active) bug in react native as Kevin made me aware of: facebook/react-native#24428. The example there with a PNG is really weird😄 There seem to be a few workarounds in there too. |
Also the consensus was that 404 is fine there, the URL is wrong with a trailing slash. I’ll still add a redirect on the public server. Won’t affect other people’s setups of course. |
You did a good search 👍🏼 😆 |
closing due to not being our issue:) |
hello ! I had to do this to fix it : |
Hello,
i'd really like to use this library !
But currently, when trying to use the example in react-native with Valhalla, it gives me :
LOG handleValhallaError [AxiosError: Request failed with status code 404]
Using the same request with curl gives a perfect answer.
Regards,
F.
The text was updated successfully, but these errors were encountered: