File tree Expand file tree Collapse file tree 1 file changed +13
-18
lines changed
packages/serverless-offline-kinesis/src Expand file tree Collapse file tree 1 file changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,6 @@ const LambdaContext = require('serverless-offline/src/LambdaContext');
28
28
const NO_KINESIS_FOUND = 'Could not find kinesis stream' ;
29
29
const KINESIS_RETRY_DELAY = 2000 ;
30
30
31
- const fromCallback = fun =>
32
- new Promise ( ( resolve , reject ) => {
33
- fun ( ( err , data ) => {
34
- if ( err ) return reject ( err ) ;
35
- resolve ( data ) ;
36
- } ) ;
37
- } ) ;
38
-
39
31
const printBlankLine = ( ) => console . log ( ) ;
40
32
41
33
const extractStreamNameFromARN = arn => {
@@ -160,17 +152,20 @@ class ServerlessOfflineKinesis {
160
152
161
153
this . serverless . cli . log ( `${ streamName } ` ) ;
162
154
163
- const kinesisStream = await fromCallback ( cb =>
164
- client . describeStream (
165
- {
166
- StreamName : streamName
167
- } ,
168
- cb
169
- )
170
- ) . catch ( err => null ) ;
171
- if ( ! kinesisStream ) {
155
+ const kinesisStream = await client
156
+ . describeStream ( {
157
+ StreamName : streamName
158
+ } )
159
+ . promise ( )
160
+ . catch ( err => err ) ;
161
+
162
+ if ( kinesisStream instanceof Error ) {
172
163
if ( retry ) {
173
- this . serverless . cli . log ( `${ streamName } - not Found, retrying in ${ KINESIS_RETRY_DELAY } ms` ) ;
164
+ this . serverless . cli . log (
165
+ `${ streamName } - not found because of ${
166
+ kinesisStream . code
167
+ } , retrying in ${ KINESIS_RETRY_DELAY } ms`
168
+ ) ;
174
169
setTimeout (
175
170
this . createKinesisReadable . bind ( this ) ,
176
171
KINESIS_RETRY_DELAY ,
You can’t perform that action at this time.
0 commit comments