-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
"PARSE" Error when using with react-native #56
Comments
Which version of |
cannot reproduce. |
i am using react native and the version is 2.8.0 but i made some changes. import buffer, import random-bytes, ... https://github.com/guitar9/hafas-client Now i get the Error JSON Parse error: Unrecongnized token '?' if I change 'Accept-Encoding': 'gzip, deflate', to 'Accept': 'application/json', i get the error PARSE |
the weird thing is when i change |
if I commend out the error part i get error "undefined is not a object (evaluating 'b.svcResL[0].res)"
|
I am willing to make |
okay thank you :)
Jannis Redmann <[email protected]> schrieb am Fr., 1. Juni 2018,
11:12:
… i am using react native and the version is 2.8.0 but i made some changes. import
buffer, import random-bytes, ...
https://github.com/guitar9/hafas-client
I am willing to make hafas-client work in react-native without any
modifications. I will create a branch for you to try.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#56 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYh5FJOqrNOqddTMXui04bwt8NMqQJG3ks5t4QVlgaJpZM4UQp4Z>
.
|
In the Will look into the HTTP headers thing. |
get now error: But after installing react-native-randombytes i get error undefined is not a object ( evaluating b.svcResL[0].res) |
What about now? I pushed c78f64d. |
I deleted the folder hafas-client and installed it again with npm install git://github.com:public-transport/hafas-client.git#react-native-browser --save how ever now i get error cant find variable Buffer.
|
tried to change .json() to .text() and comment out But only in debugging mode. In production mode i get same error "PARSE". This is really weird. this is my response:
|
this what i getting as response when i am not in debug mode: |
I have different bodys in debug mode and in production mode. I have uploaded a comparssion between the two bodys. |
Which debug and production mode are you referring to?
This is very weird. Will try to figure out why. In the meanwhile, can you try to, instead of the |
If I run my app on a device I can open dev menu and start debugger mode on device. |
tried to install hafas-client@next and node-libs-react-native. Than i have the same problem like before. In debug mode everything is fine but in normal mode the checksum and the Out date and Out time are not correct |
Here is my Example Project |
or at github |
I forgot that Please continue debugging with
Please keep it. Why would you want to remove it?
In your example project, use |
have updated it. now get error from create hash:
|
Did you use |
ok i have added it. Now i get Unrecognized token '?'. If i now comment out 'Accept-Encoding': 'gzip, deflate' i get that special case that it works in debug mode but in normal mode not. If dont comment out 'Accept-Encoding': 'gzip, deflate' i get in normal mode this error: Unrecognized token '?' and in debug mode: Unrecognized token in JSON at postion 0 |
Can you log the response by and send it? The appropriate place would be here: Line 67 in c78f64d
You can log the response like this: return fetch(url, req)
.then((res) => {
err.statusCode = res.status
if (!res.ok) {
err.message = res.statusText
throw err
}
return res.text()
})
.then((raw) => {
console.error(raw)
return JSON.parse(raw)
})
.then((b) => { |
In debug modeRequest Response
Not in debug modeRequest: Response: Error: |
This is with |
with Accept-Encoding': 'gzip, deflate', |
problem was package luxon. |
I've had a look into this once more. I successfully ran I assume all other errors are related to specifics of your local setup. I'm willing to help debug this, but only with comprehensive info. |
Hopefully prevents situations like in #56 in the future. #56 (comment)
I will close this. Please reopen with more details if you still have issues. |
Hello @derhuerst |
Hi @soldatos, please have a look at FahrplanApp for an example of hafas-client with react native. |
I can't provide a known-working version, sorry; react-native is not a priority for me, and setting it up is just too much of a hassle. I have googled a bit™ though: As of version
It also uses the following Node builtins:
|
Specifically, the shims/polyfills are defined here: https://github.com/bergmannjg/FahrplanApp/blob/a11b4272ff4623f7d015b1491ad5c2297d180dfa/metro.config.js#L24 |
Hi i get following error when i use it with react native. This is only with client.journys(..). client.locations(..) works fine.
This error is only when i am not in dubugging mode. When i am in debugging mode it works.
This is my code:
The text was updated successfully, but these errors were encountered: