23

This morning the serverless deployment of my project started to fail. I didn't change anything in the code and the last successful deployment was around a week ago.

Here's the deployment log:

Error --------------------------------------------------
 
  Error: Unknown object type "asyncfunction"
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:218:17)
      at Object._function (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:319:14)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object._function (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:319:14)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at /usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
      at Array.forEach (<anonymous>)
      at Object._object (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
      at Object.dispatch (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
      at hash (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:128:10)
      at objectHash (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:33:10)
      at Function.exports.sha1 (/usr/local/lib/node_modules/serverless/node_modules/object-hash/index.js:44:10)
      at AwsProvider.request (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:234:35)
      at AwsDeploy.uploadZipFile (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/uploadArtifacts.js:76:26)
      at BbPromise.map.concurrency (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/uploadArtifacts.js:127:21)
      at tryCatcher (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
      at MappingPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/map.js:68:38)
      at MappingPromiseArray.PromiseArray._iterate (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:115:31)
      at MappingPromiseArray.init (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:79:10)
      at MappingPromiseArray._asyncInit (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/map.js:37:10)
      at _drainQueueStep (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (node:internal/timers:463: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:              15.4.0
     Framework Version:         1.63.0
     Plugin Version:            3.3.0
     SDK Version:               2.3.0
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

I tried to look in my code for the "asyncfunction" but I could not find any occurrence. The problem seems underneath but I'm not expert enough with this framework to identify it.

1
  • 3
    Upgraded my serverless to ^1.83.3 version and it was fine. Of course you can go for latest version if you are comfortable upgrading serverless through major version Commented Jun 29, 2021 at 11:41

5 Answers 5

17

I saw the same issue this morning after a big node.js and npm upgrade to get expo and react native working locally on mac.

I ran this:

npm install -g serverless

Which seemed to update to the latest serverless. I now see more warnings about parameter naming but got a successful deploy, hope this helps!

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you! That unblocked the situation. After running that command I had a different error was unveiled about Axios missing but I fixed it with npm install --save axios and then the deployment was completed successfully. Hope it will help somebody else with the same problem. Cheers
Just tried that there sadly didnt work, any other ideas? also on a mac
@mick1996 , I was able to reproduce the issue on Node v15.11.0 with serverless v1.0.59. Everything works fine on Node v12.21.0. To fix the issue on Node 15, I suggest upgrading serverless to 2.28.3 (latest) or any other version with the upgraded object-hash in package.json, as the issue is related to object-hash version 1.3.1.
Hi there, thank you for looking into it! I was able to resolve by removing "Serverless - Offline" as there was a conflict between the versions! But your solution sounds more clean
I was hesitant to make the jump from serverless@1 to serverless@2. This forced me ;) I am very pleased how backwards compatible everything is and how good the deprecation warnings explain how to move forward.
12

I get this issue when node was updated on our server running Jenkins from 14.16.0 to 14.17.0.

Once node version downgraded to 14.16.0, error message gone.

Comments

12

This may happen when upgrading node to a newer version than the serverless version you are using supports. You can upgrade your serverless version to resolve this.

You can install the very latest version of the package if you know that there have not been any breaking changes between your version and the latest. For example:

npm install --save-dev serverless@latest

You can also specify the latest version of serverless for the "major" version that you're on. Breaking changes should only occur when the "major" version is updated, per semantic versioning, so this is a much safer option

For example, if you previously had some v1.x.y version of serverless installed, you can install the latest v1 version with:

npm install --save-dev serverless@1

this will allow you to avoid breaking changes

1 Comment

For me, it was because I ran "serverless deploy" using a node version 17.x, while using a version 14.x on my serverless. Using node 14.x fixed it.
1

Check your package.json. You're likely specifying an older version of serverless.

1 Comment

Don't at least two answers already cover this? Please don't repeat answers.
1

I had node version v14.17.3 and using nvm downgraded to v12.13.0 and it worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.