Cannot convert undefined or null to object [workfl...
# support
v
To solve the "Cannot convert undefined or null to object" error in your Vapi workflow, make sure to check if the object exists before accessing its properties. For example:
Copy code
js
const modelProvider = agent.model?.provider || 'default_provider';
This uses optional chaining to safely access
provider
only if
agent.model
is defined, preventing the error. Adjust
'default_provider'
as needed for your use case. Source: - [Discord discussion on error handling](https://discord.com/channels/1211482211119796234/1328923059905630238)
h
waiting....
how much time?
a
Hey, Could you please schedule a brief call at your convenience so we can discuss this matter in detail? Kindly use the following link to book a suitable time: .