TODAM-tw / todam-ticket-system

The frontend with gradio and combined with the API endpoints for the ticket system.
Apache License 2.0
0 stars 0 forks source link

[Bug] KeyError: 'AZURE_ML_DEPLOYED_URL' Causes Lambda Deployment Failure #24

Closed sh1un closed 4 months ago

sh1un commented 4 months ago

CloudWatch Logs

2024-05-21T02:24:46.656+-8:00   START RequestId: cffc0efa-4199-4fc7-9067-5f0211193c81 Version: $LATEST
2024-05-21T02:24:46.658+-8:00   RequestId: cffc0efa-4199-4fc7-9067-5f0211193c81 Error: Runtime exited with error: exit status 1
                                Runtime.ExitError
2024-05-21T02:24:46.658+-8:00   END RequestId: cffc0efa-4199-4fc7-9067-5f0211193c81
2024-05-21T02:24:46.658+-8:00   REPORT RequestId: cffc0efa-4199-4fc7-9067-5f0211193c81  Duration: 2171.01 ms    Billed Duration: 2172 ms    Memory Size: 8192 MB    Max Memory Used: 79 MB  
2024-05-21T02:24:57.591+-8:00   Traceback (most recent call last):
2024-05-21T02:24:57.591+-8:00   File "/var/task/app.py", line 1, in <module>
2024-05-21T02:24:57.591+-8:00   from app.views.dashboard import build_playground
2024-05-21T02:24:57.591+-8:00   File "/var/task/app/views/dashboard.py", line 5, in <module>
2024-05-21T02:24:57.591+-8:00   from app.cases.chat_history import get_row_chat_history
2024-05-21T02:24:57.591+-8:00   File "/var/task/app/cases/__init__.py", line 7, in <module>
2024-05-21T02:24:57.591+-8:00   azure_ml_deployed_url = os.environ['AZURE_ML_DEPLOYED_URL']
2024-05-21T02:24:57.591+-8:00   ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-21T02:24:57.591+-8:00   File "<frozen os>", line 679, in __getitem__
2024-05-21T02:24:57.591+-8:00   KeyError: 'AZURE_ML_DEPLOYED_URL'
2024-05-21T02:24:57.767+-8:00   EXTENSION   Name: lambda-adapter    State: Ready    Events: []
2024-05-21T02:24:57.767+-8:00   INIT_REPORT Init Duration: 2202.23 ms   Phase: invoke   Status: error   Error Type: Runtime.ExitError

我目前的暫時解決方式

我知道 AZURE 這裡的東西現在的 Ticket System 已經用不到,但為了部署成功,我在 .env 裡面先加回了 AZURE_ML_DEPLOYED_URL,可以暫時地讓程式可以抓到這個值以避免出現 ERROR image

1chooo commented 4 months ago

啊啊啊!不好意思沒有移除掉這部分,因為有跟 @ShiuanTHC 討論,未來可能有個 feature 可以挑選模型,因此還是保留了,我忘記移除 app/cases/__init__.py 的初始值,下次 PR 我先移除掉,待之後需要支援多 Model 的時候再加回!