-
Notifications
You must be signed in to change notification settings - Fork 30
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
[React Native iOS] Kiota is not working with React Native iOS #1199
Comments
Hi @AlexPalaz, |
Hi @koros, I'm testing on real device but I've also tried with emulator but didn't work unfortunately |
@AlexPalaz Alright thanks for the info I'll set up a similar environment. |
I'm not sure if this is related to the same issue, but when working on React Native (Android) I was unable to send any http requests. The error I was getting were not helpful at all. I got things like When you don't specify a custom fetch callback. Kiota defaults to
To fix this all you need to do is to create an instance of function createRequestAdapter(provider: AuthenticationProvider) {
// By Default it will use window.fetch if a fetch function is not specified.
// We need to explicitly instantiate HttpClient and specify React Native's fetch.
const httpClient = new HttpClient(fetch);
const adapter = new FetchRequestAdapter(
provider,
undefined,
undefined,
httpClient
);
return adapter;
}
function createAPIClient() {
const provider = new AnonymousAuthenticationProvider();
const adapter = createRequestAdapter(provider);
return createMyAPIClient(adapter);
}
|
Kiota TypeScript integration is not working with React Native. I'm not getting any kind of error on logs. After debugging for a while, seems like that
createClient
from kiota has not being initialized. I tried to create a customapiClientProxifier
removing all thethrow new Error
and it works untilsend
method inside theFetchRequestAdapter
. So I'm supposing there's an issue inside theapiClientProxifier
and specially onFetchRequestAdapter
.I tried on React Native Web and Kiota works fine, but on iOS is not working.
Tested on:
OS: iOS 17.5.1
React Native: 0.74.1
Expo SDK 50
The text was updated successfully, but these errors were encountered: