My lambda function is unable to unzip a file
まだ誰も着手していません。
評価
- 難易度
- 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分
- マージ済み PR(30日)
- 3
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mksglu/context-mode#1200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
neondatabase/website#5944 ·
-
module: core
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bigbluebutton/bigbluebutton#25849 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jaegertracing/jaeger-ui#4506 ·