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
I am trying to make an ajax request from localhost to localhost and am being reject by cors however my subscription never completes, it just hangs. Is this a known issue?
For example, this is my implementation of firstValueFrom (given it is not available in 6) and none of these exit points are hit, the request goes into the void and never either completes or fails:
export async function firstValueFrom(request: Observable<AjaxRequest>) : Promise<any> {
var p = new Promise((resolve, reject) => {
try {
var s = request.subscribe( (v) => {
s.unsubscribe();
resolve(v);
},
(e) => {
reject(e);
},
() => {
console.log('complete');
});
}
catch(e) {
reject(e);
}
});
var result = await p;
console.log(result);
return result;
}
The accompanying console message, letting me know the request failed is:
Access to fetch at 'http://localhost:8888/api/terminals/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to make an ajax request from localhost to localhost and am being reject by cors however my subscription never completes, it just hangs. Is this a known issue?
For example, this is my implementation of firstValueFrom (given it is not available in 6) and none of these exit points are hit, the request goes into the void and never either completes or fails:
The accompanying console message, letting me know the request failed is:
Access to fetch at 'http://localhost:8888/api/terminals/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
request.js:150 POST http://localhost:8888/api/terminals/ net::ERR_FAILED
Beta Was this translation helpful? Give feedback.
All reactions