-
-
Notifications
You must be signed in to change notification settings - Fork 40.6k
Description
Summary
The voice-call plugin's validateProviderConfig() function checks for credentials in the config file but ignores environment variables, even though:
- The error messages claim env vars work:
"(or set TWILIO_ACCOUNT_SID env)" - The actual provider initialization (
resolveProvider()) correctly falls back to env vars
This means users must put credentials in the config file even when env vars are set.
Expected Behavior
Setting TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN (or equivalent for other providers) as environment variables should satisfy the validation, matching what the error messages promise.
Actual Behavior
Validation fails with:
plugins.entries.voice-call.config.twilio.accountSid is required (or set TWILIO_ACCOUNT_SID env)
...even when TWILIO_ACCOUNT_SID is set in the environment.
Root Cause
In extensions/voice-call/src/runtime.ts:
- Line 100:
validateProviderConfig(config)runs first - only checks config values - Line 105:
resolveProvider(config)runs after - this is where env vars are merged
The validation at step 1 doesn't know about the env var fallback that happens in step 2.
Code References
Validation (doesn't check env vars) - extensions/voice-call/src/config.ts:367-378:
if (config.provider === "twilio") {
if (!config.twilio?.accountSid) {
errors.push("...is required (or set TWILIO_ACCOUNT_SID env)"); // ← doesn't actually check env
}
}Provider init (does check env vars) - extensions/voice-call/src/runtime.ts:44-50:
case "twilio":
return new TwilioProvider({
accountSid: config.twilio?.accountSid ?? process.env.TWILIO_ACCOUNT_SID, // ← env fallback here
authToken: config.twilio?.authToken ?? process.env.TWILIO_AUTH_TOKEN,
}, ...);Suggested Fix
Update validateProviderConfig() to check both config AND env vars:
if (config.provider === "twilio") {
if (!config.twilio?.accountSid && !process.env.TWILIO_ACCOUNT_SID) {
errors.push("...");
}
if (!config.twilio?.authToken && !process.env.TWILIO_AUTH_TOKEN) {
errors.push("...");
}
}Same pattern applies to Telnyx and Plivo providers.
Workaround
Add credentials directly to the config file instead of relying on env vars:
"voice-call": {
"config": {
"twilio": {
"accountSid": "AC...",
"authToken": "..."
}
}
}