Getting "Cannot convert undefined or null to object" when running sls deploy

Getting the below error message when running the sls deploy command.

D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets>sls deploy
Serverless: Bundling with Webpack…
ts-loader: Using typescript@2.9.2 and D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\tsconfig.json
Time: 8115ms
Asset Size Chunks Chunk Names
src/lambdas.js 8.08 MB 0 [emitted] [big] src/lambdas
[4] ./src/controllers/timeSheets/timeSheets_lambdas.ts 26.9 kB {0} [built]
[82] ./src/common/Utils.ts 17.7 kB {0} [built]
[110] ./src/common/errors.ts 2.71 kB {0} [built]
[195] ./src/common/Auth.ts 2.69 kB {0} [built]
[287] ./src/entities.ts 648 bytes {0} [built]
[304] ./src/lambdas.ts 3.59 kB {0} [built]
[305] ./node_modules/aws-sdk/lib/aws.js 159 bytes {0} [built]
[913] ./node_modules/jsonwebtoken/index.js 276 bytes {0} [built]
[928] ./src/controllers/timeSheets/timeSheets.ts 98 kB {0} [built]
[929] ./src/common/ConnPool.ts 7.48 kB {0} [built]
[1420] ./src/common/ListUtils.ts 651 bytes {0} [built]
[1421] ./src/common/DBOptions.ts 518 bytes {0} [built]
[1425] ./src/controllers/timeSheets/addSchema.ts 2.42 kB {0} [built]
[1426] ./src/common/models.ts 4.37 kB {0} [built]
[1427] ./node_modules/class-validator/index.js 2.98 kB {0} [built]
+ 1473 hidden modules

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
126:27-40 Critical dependency: the request of a dependency is an expression
@ ./node_modules/typeorm/platform/PlatformTools.js
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
131:23-85 Critical dependency: the request of a dependency is an expression
@ ./node_modules/typeorm/platform/PlatformTools.js
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘mongodb’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 76:27-45
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘mysql’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 81:27-43
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘mysql2’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 83:27-44
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘oracledb’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 88:27-46
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘pg’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 93:27-40
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘pg-native’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 95:27-47
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘pg-query-stream’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 97:27-53
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘redis’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 102:27-43
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can’t resolve ‘sqlite3’ in ‘D:\Mobile Apps\ACT-Nurse-Portal\API\ACTNextGen-Services\timeSheets\node_modules\typeorm\platform’
@ ./node_modules/typeorm/platform/PlatformTools.js 107:27-45
@ ./node_modules/typeorm/driver/mongodb/typings.js
@ ./node_modules/typeorm/index.js
@ ./src/common/ConnPool.ts
@ ./src/controllers/timeSheets/timeSheets.ts
@ ./src/controllers/timeSheets/timeSheets_lambdas.ts
@ ./src/lambdas.ts
Serverless: Packaging service…

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

TypeError: Cannot convert undefined or null to object
at hasOwnProperty ()
at features.constructor.validateRegionalEndpointsFlag (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\services\sts.js:92:41)
at features.constructor.optInRegionalEndpoint (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\services\sts.js:106:10)
at features.constructor.validateService (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\services\sts.js:124:10)
at features.constructor.initialize (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\service.js:52:10)
at features.constructor.Service [as constructor] (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\service.js:40:10)
at features.constructor (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\util.js:624:24)
at new features.constructor (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\util.js:624:24)
at features.constructor.Service [as constructor] (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\service.js:31:17)
at new features.constructor (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\aws-sdk\lib\util.js:624:24)
at persistentRequest (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:286:28)
at doCall (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:238:11)
at BbPromise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:260:16)
at Promise._execute (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\debuggability.js:313:9)
at Promise._resolveFromExecutor (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:488:18)
at new Promise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:79:10)
at persistentRequest (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:236:7)
at Object.request.requestQueue.add [as promiseGenerator] (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:282:7)
at Queue._dequeue (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\promise-queue\lib\index.js:153:30)
at C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\promise-queue\lib\index.js:109:18
at Promise._execute (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\debuggability.js:313:9)
at Promise._resolveFromExecutor (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:488:18)
at new Promise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:79:10)
at Queue.add (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\promise-queue\lib\index.js:94:16)
at AwsProvider.request (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:281:39)
at AwsProvider.getAccountInfo (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:508:17)
at AwsDeploy.checkLogGroupSubscriptionFilterResourceLimitExceeded (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\checkForChanges.js:184:26)
at AwsDeploy.BbPromise.bind.then.then.then.then (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\checkForChanges.js:36:21)
at AwsDeploy.tryCatcher (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:517:31)
at Promise._settlePromise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:643:18)
at Promise._resolveCallback (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:437:57)
at Promise._settlePromiseFromHandler (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:529:17)
at Promise._settlePromise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:643:18)
at PromiseArray._resolve (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise_array.js:126:19)
at PromiseArray._promiseFulfilled (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise_array.js:144:14)
at Promise._settlePromise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:579:26)
at Promise._settlePromise0 (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:643:18)
at Promise._resolveCallback (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:437:57)
at Promise._settlePromiseFromHandler (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:529:17)
at Promise._settlePromise (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:699:18)
at Promise._fulfill (C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:643:18)
at C:\Users\ejleg\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\nodeback.js:42:21
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

 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: win32
Node Version: 10.16.3
Framework Version: 1.51.0
Plugin Version: 1.3.11
SDK Version: 2.1.1

8 Likes

I have got this issue today on my current project which was still running perfectly from yesterday.
Version: 1.38.0
Update: https://github.com/serverless/serverless/issues/6659

1 Like

I’m getting the same issue when running through my CI (gitlab) - but interestingly it runs OK locally, both using serverless@1.51.0
Perhaps there is a breaking change in a dependency? (looks like aws-sdk with me)

1 Like

I see the same issue. Yesterday everything was fine.

1 Like

I’m seeing this today as well, with version 1.50.1.

1 Like

Also happening to us right now. We are using Buildkite. All of a sudden, our deploys are failing.

[2019-09-10T08:35:26Z] Prefix: ‘xxxxxxxxxxx’ })
[2019-09-10T08:35:26Z]
[2019-09-10T08:35:26Z] Type Error ---------------------------------------------
[2019-09-10T08:35:26Z]
[2019-09-10T08:35:26Z] Cannot convert undefined or null to object
[2019-09-10T08:35:26Z]
[2019-09-10T08:35:26Z] For debugging logs, run again after setting the “SLS_DEBUG=*” environment variable.
[2019-09-10T08:35:26Z]
[2019-09-10T08:35:26Z] Stack Trace --------------------------------------------
[2019-09-10T08:35:26Z]
[2019-09-10T08:35:26Z] TypeError: Cannot convert undefined or null to object
[2019-09-10T08:35:26Z] at hasOwnProperty ()
[2019-09-10T08:35:26Z] at features.constructor.validateRegionalEndpointsFlag (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/services/sts.js:92:41)

2 Likes

@nerwinchernando Identical error to ours

Yes, this has broken our build pipeline.

+ yarn deploy:dev1
yarn run v1.17.3
$ node ./node_modules/serverless/bin/serverless deploy --stage dev1 --verbose --force
...
  Type Error ---------------------------------------------
 
  TypeError: Cannot convert undefined or null to object
      at hasOwnProperty (<anonymous>)
...

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              10.15.3
     Framework Version:         1.51.0
     Plugin Version:            1.3.11
     SDK Version:               2.1.1

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Thanks

Any solution? Same error here.

I had the same issue today, I updated serverless to 1.51.0 and it went back to work.

the problem was with aws-sdk-js and they’ve commited a fix just a while ago:

If you guys reinstall serverless from scratch or removing package-lock.json it should work :smiley:

3 Likes

Things seem to be working again… jeez… Thanks!

1 Like

I still had an issue even after updating to serverless 1.51.0 and SDK 2.526.0. The problem has gone after I added [default] section to .aws/config file. I found this solution in this thread: Add support opt-in regional STS endpoints

I have the same problem too.
Version 1.51.0

It has something to do with aws-sdk- https://github.com/aws/aws-sdk-js/pull/2840