diff --git a/npm/ng-packs/packages/schematics/src/utils/source.ts b/npm/ng-packs/packages/schematics/src/utils/source.ts index 81d0b287fe..b1411b6bca 100644 --- a/npm/ng-packs/packages/schematics/src/utils/source.ts +++ b/npm/ng-packs/packages/schematics/src/utils/source.ts @@ -14,8 +14,14 @@ export async function getSourceJson(url: string) { searchParams: { includeTypes: true }, https: { rejectUnauthorized: false }, })); - } catch (e) { - throw new SchematicsException(Exception.NoApi); + } catch (err) { + // handle redirects + try { + ({ response: { body } } = err); + if (!body.types) throw Error(''); + } catch (_) { + throw new SchematicsException(Exception.NoApi); + } } return body;