# Error deploy Cannot read properties of undefined (reading 'code') New VERSION 4.4

**URL:** <https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, cloudformation\
**Created:** [September 19, 2024, 2:46am UTC](https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562 "2024-09-19T02:46:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marant08-2020](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/marant08-2020/32/8066_2.png) [@Marant08-2020](https://forum.serverless.com/u/Marant08-2020)\
**Post date:** [September 19, 2024, 2:46am UTC](https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562/1 "2024-09-19T02:46:21Z")

</div>

With the new version; I did a remove:

serverless remove

Note: CloudFornation is empty

And after every deploy is an error with these logs:

✖ Stack lambda-hello-develop failed to deploy (4s)  
s:main: Finishing  
s:core:platform:deployments: saving service deployment record to the serverless platform  
s:core:meta: saving meta record to global .serverless directory.  
s:cli-error-handler: Cannot read properties of undefined (reading ‘code’)  
TypeError: Cannot read properties of undefined (reading ‘code’)  
at AwsDeploy.ensureValidBucketExists (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/plugins/aws/deploy/lib/ensure-valid-bucket-exists.js:18:27)  
at process.processTicksAndRejections (node:internal/process/task\_queues:95:5)  
at aws:deploy:deploy:checkForChanges (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/plugins/aws/deploy/index.js:169:9)  
at PluginManager.runHooks (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:680:9)  
at PluginManager.invoke (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:719:9)  
at PluginManager.spawn (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:740:5)  
at PluginManager.runHooks (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:680:9)  
at PluginManager.invoke (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:719:9)  
at PluginManager.run (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:768:7)  
at Serverless.run (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/serverless.js:221:5)

✖ Cannot read properties of undefined (reading ‘code’)  
TypeError: Cannot read properties of undefined (reading ‘code’)  
at AwsDeploy.ensureValidBucketExists (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/plugins/aws/deploy/lib/ensure-valid-bucket-exists.js:18:27)  
at process.processTicksAndRejections (node:internal/process/task\_queues:95:5)  
at aws:deploy:deploy:checkForChanges (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/plugins/aws/deploy/index.js:169:9)  
at PluginManager.runHooks (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:680:9)  
at PluginManager.invoke (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:719:9)  
at PluginManager.spawn (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:740:5)  
at PluginManager.runHooks (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:680:9)  
at PluginManager.invoke (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:719:9)  
at PluginManager.run (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/classes/plugin-manager.js:768:7)  
at Serverless.run (/Users/mojicamarcumplo/.serverless/releases/4.3.3/serverless/lib/serverless.js:221:5)

##################################################################  
I am using a template of framwork  
serverless.yml

# “org” ensures this Service is used with the correct Serverless Framework Access Key.

org: cumplomx

# “app” enables Serverless Framework Dashboard features and sharing them with other Services.

app: marco

# “service” is the name of this project. This will also be added to your AWS resource names.

service: lambda-hello

provider:  
name: aws  
runtime: python3.12

functions:  
hello:  
handler: handler.hello

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [September 19, 2024, 7:14am UTC](https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562/2 "2024-09-19T07:14:19Z")

</div>

Can you post a minimal serverless.yml that replicates this ?

This is Serverless v4 ?

---

<div class="post-metadata">

**Author:** ![Marant08-2020](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/marant08-2020/32/8066_2.png) [@Marant08-2020](https://forum.serverless.com/u/Marant08-2020)\
**Post date:** [September 19, 2024, 3:22pm UTC](https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562/3 "2024-09-19T15:22:59Z")

</div>

Yes is Serverless v4 .4 ; The weird is all my projects are happening after run this command: serverless remove

The framework does not create stack couldFormation.

This is:

org: cumplomx

app: marco

service: lambda-hello

provider:  
name: aws  
runtime: python3.12

functions:  
hello:  
handler: handler.hello

---

<div class="post-metadata">

**Author:** ![TomC](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tomc/32/4002_2.png) [@TomC](https://forum.serverless.com/u/TomC)\
**Post date:** [September 20, 2024, 3:23pm UTC](https://forum.serverless.com/t/error-deploy-cannot-read-properties-of-undefined-reading-code-new-version-4-4/20562/4 "2024-09-20T15:23:49Z")

</div>

Glad it’s fixed.

> Post must be at least 20 characters
