Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless deploy fails: TypeError: region.toLowerCase is not a function #8134

Open
chanan opened this issue Aug 25, 2020 · 5 comments
Open
Assignees
Labels

Comments

@chanan
Copy link

chanan commented Aug 25, 2020

When running serverless deploy, the deploy fails with the error: TypeError: region.toLowerCase is not a function

serverless.yml
service: deploy-nxt

provider:
  name: aws

plugins:
  - fullstack-serverless

custom:
  fullstack:
    bucketName: devops-dashboard
    distributionFolder: build
    errorDocument: index.html
    singlePageApp: true
    priceClass: PriceClass_100
    domain: my-domain.com
    certificate: arn:...
output
serverless deploy -verbose
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions        
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command client
Serverless: Load command client:deploy
Serverless: Load command client:remove
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Load command dev
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
 
  Type Error ---------------------------------------------

  TypeError: region.toLowerCase is not a function     
      at getS3EndpointForRegion (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\aws\utils\getS3EndpointForRegion.js:4:28)      at AwsProvider.isS3TransferAccelerationSupported (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:514:22)
      at AwsPackage.generateCoreTemplate (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\aws\package\lib\generateCoreTemplate.js:67:61)
  From previous event:
      at Object.package:initialize [as hook] (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\aws\package\index.js:58:56) 
  From previous event:
      at PluginManager.invoke (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:489:22)
      at PluginManager.spawn (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:509:17)
      at C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\deploy\deploy.js:122:50
  From previous event:
      at Object.before:deploy:deploy [as hook] (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\plugins\deploy\deploy.js:102:22)  
      at C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:489:55
  From previous event:
      at PluginManager.invoke (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:489:22)
      at C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:524:24
  From previous event:
      at PluginManager.run (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\classes\PluginManager.js:524:8)
      at C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\Serverless.js:136:33
  From previous event:
      at Serverless.run (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\lib\Serverless.js:123:74)
      at C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\scripts\serverless.js:54:26
      at processImmediate (internal/timers.js:456:21) 
      at process.topLevelDomainCallback (domain.js:137:15)
  From previous event:
      at Object.<anonymous> (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\scripts\serverless.js:54:4)
      at Module._compile (internal/modules/cjs/loader.js:1138:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
      at Module.load (internal/modules/cjs/loader.js:986:32)
      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
      at Module.require (internal/modules/cjs/loader.js:1026:19)
      at require (internal/modules/cjs/helpers.js:72:18)
      at Object.<anonymous> (C:\Users\cbraunstein\AppData\Local\Yarn\Data\global\node_modules\serverless\bin\serverless.js:41:1)
      at Module._compile (internal/modules/cjs/loader.js:1138:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
      at Module.load (internal/modules/cjs/loader.js:986:32)
      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
      at internal/main/run_main_module.js:17:47

Installed version

Framework Core: 1.79.0
Plugin: 3.7.1
SDK: 2.3.1
Components: 2.34.6

NOTE:

I added a console.log to line 558 of awsProvider.js:

getRegion() {
    const defaultRegion = 'us-east-1';
    const regionSourceValue = this.getRegionSourceValue();
    console.log('regionSourceValue :>> ', regionSourceValue);
    return regionSourceValue.value || defaultRegion;
  }

And I got the following output:

regionSourceValue :>>  { path: [ 'options', 'region' ], value: true }
Serverless: Invoke package
Serverless: Invoke aws:common:validate
regionSourceValue :>>  { path: [ 'options', 'region' ], value: true }
Serverless: Invoke aws:common:cleanupTempDir
regionSourceValue :>>  { path: [ 'options', 'region' ], value: true }

Seems like value should be a string containing region.

@chanan
Copy link
Author

chanan commented Aug 25, 2020

Second note... Same issue happens in getStage(). Once I hard code both those functions I am able to deploy.

I should point out that I used to be able to deploy without an issue till a few days ago. The only thing I recall that changed is that I installed AWS CLI v2 for windows.

@medikoo
Copy link
Contributor

medikoo commented Aug 26, 2020

@chanan Do you observe same issue when not relying on a fullstack-serverless plugin?

If it's purely influenced by plugin it should be reported at its repository. If it's not influenced by plugin, can you prepare a test case that doesn't involve any plugin?

@malpaso
Copy link

malpaso commented Oct 14, 2020

Any update on this? I'm seeing the same error trying to deploy, no plugins and one function.

@myartsev
Copy link

+1

@pgrzesik
Copy link
Contributor

pgrzesik commented Dec 1, 2021

@myartsev What version of the Framework are you using? Are you using any plugins?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants