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/  
已提問 2 年前檢視次數 279 次
1 個回答
0

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

profile pictureAWS
專家
已回答 2 年前
  • 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.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南