Skip to main content

Azure OpenAI Connection Failure in Bolt v2

Overview: The application fails to establish a connection with the Azure OpenAI API when using Bolt v2, resulting in a "Connection failed" error. The exact same credentials (Endpoint, API Key, Deployment Name) work successfully in Bolt v1.

Environment Metrics:

  • Model: GPT-4o mini (Azure)

  • Success Version: Bolt v1 (Confirmed working in Screenshot 1)

  • Failure Version: Bolt v2 (Connection failed in Screenshot 2)

  • Error Message: "Connection failed. The request could not be completed (no response was received). Please try again."

Suspected Technical Causes for Investigation:

  1. Request Header construction: Azure OpenAI requires specific headers (api-key). Bolt v2 might be misformatting the header or incorrectly nested the api-key within the Bearer token field, which Azure doesn't always support depending on the SDK implementation.

  2. Endpoint URL Formatting: Bolt v2 might be appending /chat/completions or /openai/deployments/... differently than v1. If the base URL in the config includes the deployment path, v2 might be double-concatenating it, leading to a 404/Connection refused error.

  3. CORS or Proxy Issues: If Bolt v2 introduced a new backend architecture or server-side proxy, the request might be failing pre-flight or being blocked by the Azure networking firewall (reaching a "no response" state).

Recommended Debugging Steps:

  • Compare the JSON payload structure between v1 and v2; Azure is strict about the messages array format and doesn't support certain parameters that standard OpenAI does.

  • Verify if the Model Deployment Name is being passed correctly in the URL path for v2.


Summary for the Developer:Since it works in v1 but not v2 with identical settings, this is likely a change in how Bolt v2 constructs the fetch request to the Azure-specific endpoint.

Status: Completed13 comments

Log in to comment and vote

Comments13

  • Daniel Nguyen changed status to Completed
    Team•

    Apr 10

    Pinned

    I added this in v2.9.0. Thanks

    • IbrahimAlmansour-95

      •

      Apr 12

      Hi Daniel,

      I’ve tried it out in the new version 2.9.1 and it’s still not working i’m getting this error:

      Invalid endpoint URL or deployment name

      even though the same exact url and configuration works in the bolt v1 version

    • IbrahimMan

      •

      Apr 12

      Option selected attached “i’ve removed the url for privacy reasons” let me know if you want it me to share hower it’s like this:

      https://XXXX-XXX-XXX-XXXX-XXXXXX-01.azure-api.net/openai/v1/chat/completions

      • Daniel Nguyen

        Team•

        Apr 12

        Hey. You will need to enter both the custom base url and the deployment name (without the v1/chat/completions). Or you can use the Import URL button above.

        Can you share the url with me again via email, my personal email daniel@boltai.com

        Thanks

        • IbrahimMan

          •

          Apr 12

          I’ve tried it both still same issue, i’ve share the URL with you via email.

  • Daniel Nguyen

    Team•

    Jan 13

    Hi. The configuration is different between v1 and v2. But in v2, it should work if you set the correct configuration. Can you share your v2 configuration with me via email (without the api key).

    In v2, the only config required are resource name and deployment name. If there is a problem with the API version, leave it blank and try again. There is no “API endpoint” config in v2.

    • IbrahimMan

      •

      Jan 13

      Hi Daniel thank you for the prompt response I didn’t find your email anyhow i’ve attached the config below “keep in mind i’ve put XX on the domain for privacy” other than that this is exactly the config:

      Resource Name:

      https://XXXX-XXX-XXX-XXXX-aiservices-01.azure-api.net/openai/v1/chat/completions

      Deployment Name:

      GPT-4o mini

      • Daniel Nguyen

        Team•

        Jan 13

        Ah I see the issue. The resources name in this case is the one before the azure-api.net in your url.

        XXXX-XXX-XXX-XXX-aservices-01

        In v2, we follow the standard config in AI SDK:

        https://ai-sdk.dev/providers/ai-sdk-providers/azure

        Let me know if it works

        • IbrahimMan

          •

          Jan 13

          I’ve just checked so i’m using the same standard config as in the AI SDK:

          as per the AI SDK:

          https://{resourceName}.openai.azure.com/openai/v1{path}. You can use baseURL instead to specify the URL prefix.

          The one i’m using:

          https://{resourceName}.azure-api.net/openai/v1/chat/completions

          • Daniel Nguyen

            Team•

            Jan 13

            Right but in v2, I haven’t added support for custom base URL yet. It’s more confusing for most users. Did you try to set the resourceName using the value I suggested above?

            If it doesn’t work then I might need to add support for custom base URL.