Skip to content

Fix: Add protocol to Document Intelligence endpoints if missing #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 28, 2025

Issue

When using Document Intelligence with PDF files in workspaces, users encounter the error:

No connection adapters were found for '/formrecognizer/documentModels/prebuilt-read:analyze?stringIndexType=unicodeCodePoint&api-version=2023-07-31'

The error occurs because the Azure Document Intelligence endpoint in the settings doesn't have the required protocol prefix (https://), causing the API client to treat the endpoint as a relative path instead of a complete URL.

Solution

This PR adds validation to ensure both Document Intelligence endpoints (direct and APIM) always have the proper URL format with protocol:

# Ensure the endpoint has a protocol prefix
if form_recognizer_endpoint and not (form_recognizer_endpoint.startswith('http://') or form_recognizer_endpoint.startswith('https://')):
    form_recognizer_endpoint = 'https://' + form_recognizer_endpoint

The same logic is applied to the APIM endpoint.

Testing

Verified the fix with multiple test cases:

  • Endpoint without protocol -> correctly adds 'https://'
  • Endpoint with 'http://' -> keeps it unchanged
  • Endpoint with 'https://' -> keeps it unchanged
  • Empty or None endpoint -> handles gracefully, no changes

Fixes #249.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: paullizer <34814295+paullizer@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] BUG: Doc intelligence issue Fix: Add protocol to Document Intelligence endpoints if missing May 28, 2025
@Copilot Copilot AI requested a review from paullizer May 28, 2025 19:02
Copilot finished work on behalf of paullizer May 28, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Doc intelligence issue
2 participants