My lambda function is unable to unzip a file
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia con la funzione Lambda che scrive file_content in /tmp/file_path e confronta i byte ricevuti tramite Postman con l’input locale o con l’input di Heroku. Verifica l’archivio salvato con la chiamata mostrata a zipfile.ZipFile prima dell’estrazione; il lavoro è completato quando lo stesso archivio si apre e viene estratto correttamente in Lambda.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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 ?
- Lingua principale
- JavaScript
- Stelle
- 11.5k
- Fork
- 4.4k
- Merge medio
- 2h 55m
- PR unite (30g)
- 3
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di serverless/examples
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
serverless/examples#404 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
serverless/examples#809 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
serverless/examples#793 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
serverless/examples#784 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
serverless/examples#782 ·
Tutte le issue di serverless/examples
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
neondatabase/website#5944 ·
-
module: core
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·