Instrumented Python3.6 Lambda Functions return Missing Module: Queue error in Console
- Lingua principale
- Python
- Stelle
- 338
- Fork
- 147
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Previously, I had a working function in Python 3.6 below that I built by installing Boto3 and Botocore and packaging it up. No errors running in Python 3.6
```python
import boto3
import json
def handler(event,context):
client = boto3.client('ce')
s3 = boto3.resource('s3')
--- Python Code Shortened ---
object.put(Body=json.dumps(response).encode())
return str (response)
```
Decided to add instrumentation to the Function, enabled X-Ray in the Console, attached needed IAM permissions and packaged the new function with aws-xray-sdk as well as multiprocessing due to having `Missing Module: Queue` error the first time.
```python
import boto3
import json
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch
patch(['boto3'])
@xray_recorder.capture("handler")
def handler(event,context):
client = boto3.client('ce')
s3 = boto3.resource('s3')
--- Python Code Shortened ---
```
Continued to receive `Missing Module: Queue` error -- which does not make a whole lot of sense since Python 3.x+ has renamed it `queue` and it is included in the `multiprocessing` library. I now changed the beginning of the code to this
```python
import boto3
import json
try:
import queue
except ImportError:
import Queue as queue
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch
```
I have also tried the above as
```python
try:
import Queue
except ImportError:
import Queue as queue
```
However, I am still facing the issue of `Missing Module: Queue` -- is this a known issue for working with the automated decorator in X-Ray with Lambda? Is there another library I can try adding?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Non viene indicato alcun file o test del repository. Inizia riproducendo il pacchetto Lambda Python 3.6 con aws-xray-sdk e boto3, concentrandoti sul decorator automatico e sul percorso `Missing Module: Queue`; il lavoro è completato quando la funzione strumentata viene eseguita senza questo errore nella console e la causa è coperta da una modifica appropriata al repository o da un test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, python
- Ambito
- cloud, observability-sre
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100