cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

ZERO support for building cloudformation resources and incomplete documentation

Open danieljarrett74 opened this issue 3 years ago • 3 comments

I am building my project with cfn submit --set-default . It deploys it successfully, but when i go to create a stack using that new resource i get the following error:

Lambda function handler threw an uncaught exception: Unable to import module 'my_resource_name.handlers': No module named 'my_resource_name'

Nothing else, nothing in the logs. Just a bit of a mystery.

danieljarrett74 avatar Oct 25 '21 05:10 danieljarrett74

that seems to be more of a python plugin specific error. From the first sight it looks that handlers module did not get added to the zip artifact. Would you mind list the steps that you did before running cfn submit command? Are you using plugin directly (do you use docker to create an artifact) or from the pypi (if so then what version)?

ammokhov avatar Oct 25 '21 23:10 ammokhov

Thanks for the response @ammokhov , apologies for the alarmist title, I got a bit frustrated that I hadn't received a response on my last 3 issues.

To answer your questions:

I'm using docker to create the artifact and python version 3.7

I've checked the zip artifact that gets uploaded to the s3://cloudformationmanageduploadinfrast-artifactbucket

Here's what's in it.

├── ResourceProvider.zip
├── schema.json
└── src
    └── my_notifications_api
        ├── NotificationsApiFunction.zip
        ├── __init__.py
        ├── config.ini
        ├── create_handler.py
        ├── delete_handler.py
        ├── handlers.py
        ├── models.py
        └── update_handler.py

The ResourceProvider.zip contains everything in the src folder as well as all the dependant modules.

The error message I get when I try to deploy a stack is:

Lambda function handler threw an uncaught exception: Unable to import module 'my_notifications_api.handlers': No module named 'my_notifications_api'

Interestingly I was able to run the CREATE and DELETE commands locally successfully. Using:

sam local invoke TestEntrypoint --event example_inputs/create.json  
sam local invoke TestEntrypoint --event example_inputs/delete.json  

After I successfully created and deleted my resources locally I submitted using:

cfn submit --set-default

danieljarrett74 avatar Oct 26 '21 04:10 danieljarrett74

@ammokhov Surely I could get a response within 11 days.

danieljarrett74 avatar Nov 06 '21 05:11 danieljarrett74