https://retellai.com/?utm_source=discord&utm_medium=seo logo
I am getting an 500 error while trying to integrat...
# ❓・ai-evy-support
v
@AI Evy I am getting an 500 error while trying to integrate the agent on a chat widget.
a
Thanks for tagging me @vishal.gopinath. I'll look through relevant sources and get back to you shortly.
### Answer The sources provided don't contain specific troubleshooting steps for 500 errors with the chat widget [(1) ]() . However, I can help you verify your setup. For the Chat Widget, ensure you're using the correct setup :
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_CHAT_AGENT_ID"
  data-agent-version="YOUR_AGENT_VERSION"
></script>
Key requirements to verify : - You must use a chat agent ID (not a voice agent ID) for the chat widget - You need a valid Retell Public Key (not an API key) - If using reCAPTCHA, ensure you're using reCAPTCHA v3 (v2 is not supported) If you're making direct API calls, the Create Chat Completion endpoint expects [(2) ]() : - A valid
chat_id
- User message
content
- Proper authorization header with your API key For further assistance with this specific 500 error, I recommend: Check out these potentially useful sources: [Retell Website Widget]() , [Create Chat Completion]() You can also visit [Contact Sales]() or [) for additional support. Would you like me to provide a general troubleshooting approach for 500 errors?
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Create Chat Completion](https://docs.retellai.com/api-references/create-chat-completion) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
v
Getting the error here: GET https://api.retellai.com/get-chat/undefined 500 (Internal Server Error) (anonymous) @ retell-widget.js:811 (anonymous) @ retell-widget.js:620 (anonymous) @ retell-widget.js:696 d @ retell-widget.js:706 l @ retell-widget.js:720 (anonymous) @ retell-widget.js:725 (anonymous) @ retell-widget.js:717 g @ retell-widget.js:822 f @ retell-widget.js:799 (anonymous) @ retell-widget.js:1958 (anonymous) @ retell-widget.js:1174 (anonymous) @ retell-widget.js:1250 L @ retell-widget.js:1260 l @ retell-widget.js:1274 (anonymous) @ retell-widget.js:1279 (anonymous) @ retell-widget.js:1271 se @ retell-widget.js:2060 de @ retell-widget.js:1918Understand this error retell-widget.js:762 POST https://api.retellai.com/create-chat 500 (Internal Server Error) (anonymous) @ retell-widget.js:762 (anonymous) @ retell-widget.js:620 (anonymous) @ retell-widget.js:696 d @ retell-widget.js:706 l @ retell-widget.js:720 (anonymous) @ retell-widget.js:725 (anonymous) @ retell-widget.js:717 p @ retell-widget.js:795 u @ retell-widget.js:731 (anonymous) @ retell-widget.js:2297 (anonymous) @ retell-widget.js:1174 (anonymous) @ retell-widget.js:1250 L @ retell-widget.js:1260 l @ retell-widget.js:1274 Promise.then L @ retell-widget.js:1265 l @ retell-widget.js:1274 (anonymous) @ retell-widget.js:1279 (anonymous) @ retell-widget.js:1271 we @ retell-widget.js:2312 ve @ retell-widget.js:2271 (anonymous) @ retell-widget.js:2335 (anonymous) @ retell-widget.js:1174 (anonymous) @ retell-widget.js:1250 L @ retell-widget.js:1260 l @ retell-widget.js:1274 (anonymous) @ retell-widget.js:1279 (anonymous) @ retell-widget.js:1271 je @ retell-widget.js:2431 onFormSubmit @ retell-widget.js:1644Understand this error retell-widget.js:837 POST https://api.retellai.com/create-chat-completion 500 (Internal Server Error)
@AI Evy Any luck on finding any info on this?
a
Thanks for the follow-up, @vishal.gopinath. I'll get back to you soon.
### Answer Based on the error logs, you're encountering 500 errors on three endpoints:
get-chat/undefined
,
create-chat
, and
create-chat-completion
. The
get-chat/undefined
error indicates the widget is trying to retrieve a chat with an undefined
chat_id
[(1) ]() . This typically happens when the initial chat creation fails. For the Create Chat endpoint, verify your request includes [(2) ]() : -
agent_id
(required) - the chat agent ID - Valid authorization header with your API key - Optional:
agent_version
,
metadata
, or
retell_llm_dynamic_variables
For Create Chat Completion, ensure you're providing [(3) ]() : -
chat_id
(required) - unique ID of the chat -
content
(required) - the user message - Proper authorization header The 500 errors suggest either: 1. Invalid agent configuration (check that your agent_id exists and is properly configured as a chat agent) [(2) ]() [(4) ]() 2. Missing or invalid API credentials in the authorization header [(3) ]() [(2) ]() 3. Malformed request payload Check out these potentially useful sources: [Create Chat]() , [Create Chat Completion]() , [Get Chat]() For additional support, visit [Contact Sales]() or [) . Would you like a general troubleshooting approach for debu
gging these API calls?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
v
@User But as soon as I click on the widget on bottom left corner, I get the following error: retell-widget.js:811 GET https://api.retellai.com/get-chat/undefined 500 (Internal Server Error)
@AI Evy But as soon as I click on the widget on bottom left corner, I get the following error: retell-widget.js:811 GET https://api.retellai.com/get-chat/undefined 500 (Internal Server Error)
a
Thanks for the follow-up, @vishal.gopinath. I'll get back to you soon.
leshooting approach for debugging the widget initialization?
### Answer The `GET error indicates the widget is attempting to retrieve a chat with an undefined
chat_id
[(1) ]() . This happens when the initial chat creation fails or the
chat_id
isn't being properly stored/passed to subsequent API calls . The Get Chat endpoint requires a valid
chat_id
in the path parameter to retrieve chat details . When the widget shows
undefined
, it means no valid
chat_id
exists yet . Since you're seeing this error immediately upon clicking the widget, the root cause is likely in your widget initialization. Double-check that: 1. Your
data-agent-id
in the widget script tag points to a valid chat agent (not a voice agent) 2. Your
data-public-key
is correctly set with your Retell Public Key 3. The agent specified exists and is properly configured for chat mode The 500 errors on
create-chat
and
create-chat-completion
endpoints suggest the initial chat creation is failing [(2) ]() , which prevents a valid
chat_id
from being generated [(1) ]() . This cascades into the
undefined
error when the widget tries to fetch the non-existent chat . Check your browser's Network tab to inspect the actual request payload being sent to
/create-chat
. Verify it includes a valid
agent_id
[(2) ]() . Check out these potentially useful sources: [Get Chat]() , [Create Chat Completion]() For additional support, visit [Contact Sales]() or [) . Would you like a general troub
​ To learn more, see the sources I considered: [[1] Get Chat](https://docs.retellai.com/api-references/get-chat) [[2] Create Chat Completion](https://docs.retellai.com/api-references/create-chat-completion) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.