Skip to content

Commit 4eb8cb3

Browse files
committed
skip check fc region
1 parent d306277 commit 4eb8cb3

5 files changed

Lines changed: 7 additions & 54 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ __tests__/e2e/custom.debian10/python/code/python
5757
__tests__/e2e/custom/python/code/python
5858
__tests__/e2e/python/code/python
5959
__tests__/e2e/python/code/apt-archives
60+
__tests__/e2e/apt/code/package-lock.json
6061

6162
.env_test

__tests__/e2e/apt/code/package-lock.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

__tests__/ut/interface_test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
IHttpTriggerConfig,
55
checkRegion,
66
IRegion,
7-
RegionList,
87
} from '../../src/interface';
98
import log from '../../src/logger';
109
log._set(console);
@@ -215,11 +214,13 @@ describe('checkRegion', () => {
215214
);
216215
});
217216

217+
/*
218218
it('should throw an error if region is invalid', () => {
219219
expect(() => checkRegion('invalid-region' as IRegion)).toThrow(
220220
`Invalid region, The allowed regions are ${RegionList}`,
221221
);
222222
});
223+
*/
223224

224225
it('should true when r is cn-hangzhou', () => {
225226
const result = checkRegion('cn-hangzhou');

src/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default class Base {
7272
FC.isCustomContainerRuntime(inputs.props.runtime) &&
7373
!IMAGE_ACCELERATION_REGION.includes(inputs.props.region)
7474
) {
75-
throw new Error(
75+
log.warn(
7676
`The region ${inputs.props.region} does not support custom container image acceleration, please use another region, details: https://help.aliyun.com/zh/fc/product-overview/region-availability`,
7777
);
7878
}

src/interface/region.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import logger from '../logger';
2+
13
enum Region {
24
'cn-hangzhou' = 'cn-hangzhou',
35
'cn-shanghai' = 'cn-shanghai',
@@ -36,7 +38,7 @@ export function checkRegion(r: IRegion): boolean {
3638
throw new Error('Region not specified, please specify --region');
3739
}
3840
if (!RegionList.includes(r)) {
39-
throw new Error(`Invalid region, The allowed regions are ${RegionList}`);
41+
logger.warn(`Invalid region, The allowed regions are ${RegionList}`);
4042
}
4143
return true;
4244
}

0 commit comments

Comments
 (0)