You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library isn't working on Blazor WASM because of this 'x-query-timeout' header usage.
All HTTPClient calls get exceptions like:
Access to fetch at 'https://db.fauna.com/' from origin 'https://.....' has been blocked by CORS policy: Request header field x-query-timeout is not allowed by Access-Control-Allow-Headers in preflight response.
Until this issue is solved on the FaunaDB cloud side you can use the following workaround:
Remove the 'x-query-timeout' header in the request.
public class MessageHandler : DelegatingHandler
{
public MessageHandler(HttpClientHandler httpClientHandler) :
base(httpClientHandler)
{ }
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
// Dont use header 'X-Query-Timeout' for CORS policy
request.Headers.Remove("X-Query-Timeout");
return base.SendAsync(request, cancellationToken);
}
}
public async void ContactFaunaDb()
{
var httpClient = new HttpClient(new MessageHandler(new HttpClientHandler()));
var faunaDb = new FaunaClient(endpoint: Endpoint, secret: Secret, httpClient: httpClient);
var rawIndexValues = await faunaDb.Query(Paginate(Match(Index("some_index"))));
/// etc....
}
The text was updated successfully, but these errors were encountered:
This library isn't working on Blazor WASM because of this 'x-query-timeout' header usage.
All HTTPClient calls get exceptions like:
Access to fetch at 'https://db.fauna.com/' from origin 'https://.....' has been blocked by CORS policy: Request header field x-query-timeout is not allowed by Access-Control-Allow-Headers in preflight response.
Until this issue is solved on the FaunaDB cloud side you can use the following workaround:
Remove the 'x-query-timeout' header in the request.
The text was updated successfully, but these errors were encountered: