arabold / serverless-export-env

Serverless plugin to export environment variables into a .env file
MIT License
103 stars 34 forks source link

Error with serverless v2.23.0 #27

Closed dennistruemper closed 3 years ago

dennistruemper commented 3 years ago

Hi, I wanted to upgrade to serverless version 2.23.0 and had a problem.

Right know this is what I know:

Type Error ---------------------------------------------

  TypeError: AWS.request(...).then(...).return is not a function
      at describeStack (/Users/dennis/git/sportsplaner/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:16:12)
      at collectStackOutputs (/Users/dennis/git/sportsplaner/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:28:10)
      at /Users/dennis/git/sportsplaner/node_modules/serverless-export-env/src/index.js:60:9
      at tryCatcher (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/method.js:39:29)
      at ExportEnv.collectEnvVars (/Users/dennis/git/sportsplaner/node_modules/serverless-export-env/src/index.js:56:25)
      at /Users/dennis/git/sportsplaner/node_modules/serverless/lib/classes/PluginManager.js:500:55
      at tryCatcher (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/reduce.js:168:18)
      at Object.gotAccum (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/Users/dennis/git/sportsplaner/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.19.1
     Framework Version:         2.23.0 (local)
     Plugin Version:            4.4.2
     SDK Version:               2.3.2
     Components Version:        3.6.2 

The same error is reproducable with Linux:

serverless: Invoke export-env

  Type Error ---------------------------------------------

  TypeError: AWS.request(...).then(...).return is not a function
      at describeStack (/home/runner/work/sportsplaner/sportsplaner/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:16:12)
      at collectStackOutputs (/home/runner/work/sportsplaner/sportsplaner/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:28:10)
      at /home/runner/work/sportsplaner/sportsplaner/node_modules/serverless-export-env/src/index.js:60:9
      at tryCatcher (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/method.js:39:29)
      at ExportEnv.collectEnvVars (/home/runner/work/sportsplaner/sportsplaner/node_modules/serverless-export-env/src/index.js:56:25)
      at /home/runner/work/sportsplaner/sportsplaner/node_modules/serverless/lib/classes/PluginManager.js:500:55
      at tryCatcher (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/reduce.js:168:18)
      at Object.gotAccum (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/home/runner/work/sportsplaner/sportsplaner/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.15.4
     Framework Version:         2.23.0 (local)
     Plugin Version:            4.4.2
     SDK Version:               2.3.2
     Components Version:        3.6.2

Let me know if i cant do something to help.

Gi0rgi0s commented 3 years ago

bump. I am having the exact same issue with exact same stack trace

ghost commented 3 years ago

+1

andre-at-clubien commented 3 years ago

This is still ongoing (Feb-14 2021)

Serverless: Invoke export-env

  Type Error ---------------------------------------------

  TypeError: AWS.request(...).then(...).return is not a function
      at describeStack (/builds/clubientech/hedwig/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:16:12)
      at collectStackOutputs (/builds/clubientech/hedwig/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:28:10)
      at /builds/clubientech/hedwig/node_modules/serverless-export-env/src/index.js:60:9
      at tryCatcher (/builds/clubientech/hedwig/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/builds/clubientech/hedwig/node_modules/bluebird/js/release/method.js:39:29)
      at ExportEnv.collectEnvVars (/builds/clubientech/hedwig/node_modules/serverless-export-env/src/index.js:56:25)
      at /usr/lib/node_modules/serverless/lib/classes/PluginManager.js:500:55
      at tryCatcher (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:168:18)
      at Object.gotAccum (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.15.4
     Framework Version:         2.23.0
     Plugin Version:            4.4.3
     SDK Version:               2.3.2
     Components Version:        3.6.2

I can also confirm that I do not see that issue when running on node v15.5.1. Unfortunately, updating to Node v15 is not possible at the moment for the CI/CD servers in use. I guess it is sensible to expect a fix at the plugin level.

daniele-pelagatti commented 3 years ago

Hello, first of all thanks for your invaluable work on this plugin, I've used it for years and I'll never thank you enough :)

I'm having a rough time fighting with the problem mentioned above, I even made a minimum repro here minrepro.zip

basically I just install serverless, serverless-export-env, make a minimal serverless.yml file and try to run: npx serverless export-env you can also set the appropriate "service", "stage" and "region" in order to get rid of the "stack not found error", all that remains is this:

$ npx serverless export-env

 Type Error ----------------------------------------------

  TypeError: AWS.request(...).then(...).return is not a function
      at describeStack (/home/daniele/Desktop/test/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:16:12)
      at collectStackOutputs (/home/daniele/Desktop/test/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:28:10)
      at /home/daniele/Desktop/test/node_modules/serverless-export-env/src/index.js:60:9
      at tryCatcher (/home/daniele/Desktop/test/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/home/daniele/Desktop/test/node_modules/bluebird/js/release/method.js:39:29)
      at ExportEnv.collectEnvVars (/home/daniele/Desktop/test/node_modules/serverless-export-env/src/index.js:56:25)
      at PluginManager.invoke (/home/daniele/Desktop/test/node_modules/serverless/lib/classes/PluginManager.js:544:20)
      at /home/daniele/Desktop/test/node_modules/serverless/lib/classes/PluginManager.js:579:24
      at tryCatcher (/home/daniele/Desktop/test/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/daniele/Desktop/test/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/daniele/Desktop/test/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/home/daniele/Desktop/test/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/home/daniele/Desktop/test/node_modules/bluebird/js/release/promise.js:729:18)
      at _drainQueueStep (/home/daniele/Desktop/test/node_modules/bluebird/js/release/async.js:93:12)
      at _drainQueue (/home/daniele/Desktop/test/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/home/daniele/Desktop/test/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/home/daniele/Desktop/test/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.16.0
     Framework Version:         2.31.0 (local)
     Plugin Version:            4.5.2
     SDK Version:               4.2.2
     Components Version:        3.7.7

if I force a serverless version < 2.23.0 (for example 2.22.0) everything works fine again.

$ npx serverless export-env
Serverless: Deprecation warning: Detected ".env" files. Note that Framework now supports loading variables from those files when "useDotenv: true" is set (and that will be the default from next major release)
            More Info: https://www.serverless.com/framework/docs/deprecations/#LOAD_VARIABLES_FROM_ENV_FILES
Serverless: Deprecation warning: Starting with next major version, default value of provider.lambdaHashingVersion will be equal to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
$ npx serverless --version
Framework Core: 2.22.0 (local)
Plugin: 4.5.2
SDK: n/a
Components: 3.7.7

Is there a solution to this?

serverlesspolska commented 3 years ago

@daniele-pelagatti I'm afraid nothing has been done yet.

@arabold Could you please take a look at the problem?

I have the same problem on SF 2.37. The root cause lays in this plugin :-(

sls export-env -s $STAGE

 Type Error ----------------------------------------------

  TypeError: AWS.request(...).then(...).return is not a function
      at describeStack (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:16:12)
      at collectStackOutputs (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless-export-env/src/lib/collectStackOutputs.js:28:10)
      at /Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless-export-env/src/index.js:60:9
      at tryCatcher (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/bluebird/js/release/method.js:39:29)
      at ExportEnv.collectEnvVars (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless-export-env/src/index.js:56:25)
      at PluginManager.invoke (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless/lib/classes/PluginManager.js:552:20)
      at PluginManager.run (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless/lib/classes/PluginManager.js:598:18)
      at async Serverless.run (/Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless/lib/Serverless.js:313:5)
      at async /Users/pawel/ptc/oldportal/eip-removal-etl/node_modules/serverless/scripts/serverless.js:612:9

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.18.4
     Framework Version:         2.37.0 (local)
     Plugin Version:            4.5.3
     SDK Version:               4.2.2
     Components Version:        3.9.0
serverlesspolska commented 3 years ago

Thanks @arabold for doing the release. The issue is solved 👍