File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,25 @@ class Cos {
34
34
throw new Error ( JSON . stringify ( e ) )
35
35
}
36
36
} else {
37
- throw new Error ( JSON . stringify ( e ) )
37
+ // cos在云函数中可能出现ECONNRESET错误,没办法具体定位,初步猜测是客户端问题,是函数启动网络还没准备好,这个还不确定,所以在这里做兼容
38
+ if ( JSON . stringify ( e ) . includes ( 'ECONNRESET' ) ) {
39
+ // 检查bucket是否存在
40
+ const headHandler = util . promisify ( this . cosClient . headBucket . bind ( this . cosClient ) )
41
+ try {
42
+ const isHave = await headHandler ( createParams )
43
+ if ( isHave . statusCode == 200 ) {
44
+ if ( ! inputs . force ) {
45
+ throw new Error ( 'BucketAlreadyExists and BucketAlreadyOwnedByYou' )
46
+ }
47
+ } else {
48
+ throw new Error ( 'Could not find this bucket' )
49
+ }
50
+ } catch ( err ) {
51
+ throw new Error ( JSON . stringify ( err ) )
52
+ }
53
+ } else {
54
+ throw new Error ( JSON . stringify ( e ) )
55
+ }
38
56
}
39
57
}
40
58
}
Original file line number Diff line number Diff line change @@ -311,12 +311,12 @@ class Scf {
311
311
thisTrigger [ 'parameters' ] [ 'filter' ] &&
312
312
thisTrigger [ 'parameters' ] [ 'filter' ] [ 'prefix' ]
313
313
? thisTrigger [ 'parameters' ] [ 'filter' ] [ 'prefix' ]
314
- : '' ,
314
+ : String ( '' ) ,
315
315
Suffix :
316
316
thisTrigger [ 'parameters' ] [ 'filter' ] &&
317
317
thisTrigger [ 'parameters' ] [ 'filter' ] [ 'suffix' ]
318
318
? thisTrigger [ 'parameters' ] [ 'filter' ] [ 'suffix' ]
319
- : ''
319
+ : String ( '' )
320
320
}
321
321
} )
322
322
trigger . Enable = inputs . events [ i ] [ 'cos' ] [ 'parameters' ] [ 'enable' ] ? 'OPEN' : 'CLOSE'
You can’t perform that action at this time.
0 commit comments