My lambda function is unable to unzip a file
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
调研方向
从将 file_content 写入 /tmp/file_path 的 Lambda 函数开始,将通过 Postman 接收的字节与本地输入或 Heroku 输入进行比较。在提取之前,使用所示的 zipfile.ZipFile 调用验证保存的存档;当同一个存档能够在 Lambda 中成功打开并提取时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I deployed a flask app to lambda that includes a function that unzip a small file (124ko), but nothing works as expected. The unzipping clearly fail and I can't find the reason.
2021-03-23T12:12:46.346+01:00 error [/tmp/39423ff39f7f4378a8f835a20fdcb688.zip]: missing 3183398882 bytes in zipfile
2021-03-23T12:12:46.346+01:00 (attempting to process anyway)
2021-03-23T12:12:46.346+01:00 error [/tmp/39423ff39f7f4378a8f835a20fdcb688.zip]: start of central directory not found;
2021-03-23T12:12:46.346+01:00 zipfile corrupt.
2021-03-23T12:12:46.346+01:00 (please check that you have transferred or created the zipfile in the
2021-03-23T12:12:46.346+01:00 appropriate BINARY mode and that you have compiled UnZip properly)
There is no problem when testing locally and the zip file is okay. So I guess the issue comes from lambda.
The code :
with open(file_path, "wb") as binary_file:
binary_file.write(file_content)
Expected behavior : The file should unzip without problem just as it does when the app runs locally or in heroku.
P.S. I am using postman for testing
EDIT : also tried to extract with zipfile
with zipfile.ZipFile('/tmp/myfile.zip', 'r') as z:
z.extractall(fil_dir)
and got the following error :
raise BadZipFile("Bad magic number for central directory")
Originally I was extracting with
os.system("unzip -qq %s -d %s" % (file_path,file_dir))
Any suggestion ?
- 主要语言
- JavaScript
- 星标
- 11.5k
- 派生
- 4.4k
- 平均合并
- 2 小时 55 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
serverless/examples 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 62/100
serverless/examples#404 ·
-
难度 3/5 1-2 天 新手友好度 35/100
serverless/examples#809 ·
-
难度 2/5 1-3 小时 新手友好度 30/100
serverless/examples#793 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
serverless/examples#784 ·
-
难度 4/5 3-5 天 新手友好度 25/100
serverless/examples#782 ·
查看 serverless/examples 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
Issue-Bug
难度 2/5 1-3 小时 新手友好度 68/100
sugarlabs/musicblocks#8924 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ArduPilot/ardupilot_wiki#8088 ·
-
[BUG] createTool tools cannot be registered with Mastra when exactOptionalPropertyTypes is enabled 未关闭customer-eng status: needs triage
难度 2/5 1-3 小时 新手友好度 84/100