Hi Cédric,
Thank you for your question! It sounds like you're on the right track, and you're likely encountering a configuration issue related to environment variables or service discovery in your AI Foundry-exported Teams bot.
Error Explanation
The error message:
cpp
Copy
Error: Discover::regionGtm::InvalidResponse - searchService is missing in discover response
indicates that the bot is failing to find a required service (likely searchService
) during the discovery phase—possibly due to:
- A missing or incorrect environment variable
A misconfigured API endpoint or region
Failure to register or initialize required services
Suggested Debugging & Fixes
Here’s how to proceed:
- Verify Environment Variables
Double-check that you have correctly set all required environment variables in your deployment:
AZURE_OPENAI_KEY
AZURE_OPENAI_ENDPOINT
AZURE_SEARCH_SERVICE
(if applicable)
AZURE_SEARCH_INDEX_NAME
AZURE_SEARCH_API_KEY
Make sure these are passed correctly into the runtime environment—especially if using Azure App Service or Azure Functions. You can test this locally using .env
files and dotenv
package.
- Check App Registration in Azure
Ensure the Teams bot is correctly registered with Azure AD:
Validate App ID, password, and redirect URIs in the Azure portal.
Verify the Bot Channel Registration includes the Microsoft Teams channel and messaging endpoint is correctly configured.
- Enable Logging for Debugging
You can get visibility into bot runtime errors by:
Enabling Application Insights on your deployed service.
Wrapping your handlers with try-catch and printing logs to the console or telemetry.
Using az webapp log tail
or Azure Portal's Log Stream for live logs.
- Test with Microsoft 365 Toolkit Logs
The Microsoft 365 Agents Toolkit includes local testing support—ensure it’s configured for verbose logs:
bash
Copy
npx teamsfx doctor
npx teamsfx preview
Check for any mismatch in API keys or missing services in logs.
- Bot Timeout or Teams Channel Setup
If the bot doesn’t respond in Teams:
Confirm messaging endpoint (e.g. /api/messages
) is live and accessible.
Check if App manifest is correctly generated with validDomains
.
Try reinstalling the app in Teams after any config change.
Let me know I’d be happy to guide you further.
Best regards,
Volunteer Contributor – Microsoft Q&A