S3 ENV does not work as described in the Runpod Documention
Hi all, I have a serverless function and also all env variable as its written in documention. But its undefined in the runpod logs. I have added all this example of ENV to my template but none of them are working.
this snippet is from my rp handler and all are empty strings.
this is how i call the handler:
and this is my handler:
this is also my start.sh script:
it would be nice if someone can help me.
thanks
21 Replies
BUCKET_ACCESS_KEY_ID
BUCKET_ENDPOINT_URL
BUCKET_SECRET_ACCESS_KEY
note you need to set them in template and not in handler
yes i added them also in the template
what do you mean not in handler?
I mean you do not define them in handler file if you use rp.upload
just add them in template before deploy
I have not defined it in handler, I have only defined it in template before deploy.
i only wrote this logger for testing to see if it works. but it is empty string
is it js?
no python
what error do you get?
so basically Bad Request 400
though I do not see error. I'm not sure what is happening with worker does it not upload image?
but you can see down there my env's are empty and rest of code will not work
i sent you the rp-handler.py, so bascially i need to download first a image from s3 and im doing that with boto3. Boto need the env and thats why its failed
btw you know you do not need to iplement booto yourself
from runpod.serverless.utils import rp_download, upload_file_to_bucket, upload_in_memory_object
then use upload_file_to_bucket
here is example of mine https://github.com/kodxana/worker-deoldify/blob/main/src/handler.py
GitHub
worker-deoldify/src/handler.py at main · kodxana/worker-deoldify
DeOldify worker for RunPod serverless. Contribute to kodxana/worker-deoldify development by creating an account on GitHub.
yes exactly, unfortunately we needed boto because we generated a presigned url with accesskey, then we used rp-download to download it.
Are you calling your handler from the Dockerfile or is it called within a bash script like start.sh?
its a fork from your runpod-worker-inswapper 😄 so yes its from start-standalon.sh
Try adding:
etc into your
start.sh
script.
Make sure to increment the docker image tag as well.ok i test it now, yes i always increment the tag 👍
so i tested but the problem is still there
still env1 and env2 empty
also fyi, it work local on my machine
python3 -u rp_handler.py --rp_serve_api
i have this in my start.sh
and this is how i call the start.sh:
an interesting thing i found out now is that when i enter a wrong input to generate a validation error. I don't get a validation error but exactly the same behavior.
but get the error locally. so i don't get it