I created a layer and it did work.

0

Here is the context of my zip file.
I installed a python package with "python setup.py install --prefix=." command.
And this package doesn't exist on pypi so I have to install this way.

zip -sf test.zip  
Archive contains:  
  python/  
  python/openapi_client.egg-info/  
  python/openapi_client.egg-info/top_level.txt  
  python/openapi_client.egg-info/dependency_links.txt  
  python/openapi_client.egg-info/requires.txt  
  python/openapi_client.egg-info/PKG-INFO  
  python/openapi_client.egg-info/SOURCES.txt  
  python/dist/  
  python/dist/openapi_client-1.0.0-py3.8.egg  
  python/lib/  
  python/lib/python3.8/  
  python/lib/python3.8/site-packages/  
  python/lib/python3.8/site-packages/openapi_client-1.0.0-py3.8.egg  
  python/build/  
  python/build/bdist.linux-x86_64/  
asked 2 years ago264 views
1 Answer
0

Have you tried doing zip -r test.zip - that works for the layers I have here.

profile pictureAWS
EXPERT
answered 2 years ago
  • Yeah, I used this command to build test.zip file. I used the same procedure to build another layer which contains some packages piped from pypi and it worked. So I'm pretty sure the procedure is correct. But I don't know why this layer doesn't work.

  • I'd suggest creating smaller, less complex layers. If they work then gradually work your way up to things that are more complex (such as your example) to see where things are breaking. Are you building the layer on an Amazon Linux EC2 instance?

  • Yes, I built it on a EC2 instance. This layer only contains one package. I wonder if it's because the file in this package is egg file not .py file so that it can't be recognized?

  • Here is the runtime error message: ''' { "errorMessage": "Unable to import module 'lambda_function': No module named 'openapi_client'", "errorType": "Runtime.ImportModuleError", "stackTrace": [] } '''

  • I've only ever tried building layers with .py files so that's definitely a place to check.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions