permission-backend: replace cross-fetch with node-fetch
Signed-off-by: Mike Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
@@ -21,14 +21,13 @@
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.9.9",
|
||||
"@backstage/config": "^0.1.11",
|
||||
"@backstage/errors": "^0.1.4",
|
||||
"@backstage/plugin-auth-backend": "^0.4.7",
|
||||
"@backstage/plugin-permission-common": "^0.1.0",
|
||||
"@backstage/plugin-permission-node": "^0.0.0",
|
||||
"@types/express": "*",
|
||||
"cross-fetch": "^3.0.6",
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^4.1.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0",
|
||||
"zod": "^3.11.6"
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('PermissionIntegrationClient', () => {
|
||||
resourceType: 'test-resource',
|
||||
conditions: mockConditions,
|
||||
}),
|
||||
).rejects.toThrowError(/request failed with 401/i);
|
||||
).rejects.toThrowError(/401/i);
|
||||
});
|
||||
|
||||
it('should reject invalid responses', async () => {
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import fetch from 'cross-fetch';
|
||||
import fetch from 'node-fetch';
|
||||
import { z } from 'zod';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import {
|
||||
AuthorizeResult,
|
||||
@@ -73,7 +72,9 @@ export class PermissionIntegrationClient {
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
throw new Error(
|
||||
`Unexpected response from plugin upstream when applying conditions. Expected 200 but got ${response.status} - ${response.statusText}`,
|
||||
);
|
||||
}
|
||||
|
||||
return responseSchema.parse(await response.json());
|
||||
|
||||
Reference in New Issue
Block a user