Skip to content

Core HTTP fetch returns incorrect error when a request is aborted #56244

@lukasolson

Description

@lukasolson

Steps to reproduce:

const abortController = new AbortController();
const { signal } = abortController;
const promise = core.http.fetch({
  path: '/path/to/some/route',
  method: 'GET',
  signal
});
setTimeout(() => abortController.abort(), 5);
await promise;

You'd expect the error to be thrown here to be a DOM AbortError, but instead you get TypeError: Cannot read property 'credentials' of undefined.

It looks like we're not properly checking if request exists in the unauthorized response HTTP interceptor. This probably happened here, since we were no longer throwing our own error, but forwarding along the error from the DOM.

Metadata

Metadata

Assignees

Labels

Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//Team:SecurityPlatform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t//bugFixes for quality problems that affect the customer experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions