continuedev / continuedev/continue

Azure OAI in v0.8.63-vscode got Error: Error parsing response body: SyntaxError: Unexpected token 'A', "Authorizat"... is not valid JSON

Open
#3,424 4 comments 0 reactions 1 assignee View on GitHub

@RomneyDa is already working on this.

Since Dec 17, 2024.

area:configuration ide:vscode kind:bug needs-triage os:mac stale
Dominant language
TypeScript
Stars
36k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Before submitting your bug report
Relevant environment info
- OS: macOS
- Continue version: v0.8.63 and v0.9.245
- IDE version: VSCode 1.96.0
- Model: Azure OpenAI GPT-4o
- config.json:
  
    {
      "model": "gpt-4o-20240806",
      "contextLength": 128000,
      "title": "GPT-4o",
      "systemMessage": "You are an expert software developer. You give helpful and concise responses.",
      "apiKey": "...",
      "apiBase": "...",
      "apiVersion": "2024-09-01-preview",
      "apiType": "azure",
      "provider": "azure",
      "useLegacyCompletionsEndpoint": false,
      "deployment": "gpt-4o-20240806"
    },
Description

We have our own API server and auth service for Azure OpenAI, the apikey used in the config is actually a JWT (with 2 dots in it to split the header, payload and signature), not sure if something added from 0.8.63 that parses the apiKey and breaks json body.

0.8.63 and the latest prerelease 0.9.245 both have this error, haven't tried any other prerelease versions but suppose to be the same error.

Rollback to 0.8.61 and any versions before are ok without any error.

To reproduce

No response

Log output
ERR [Extension Host] Error handling webview message: {
  "msg": {
    "messageId": "7ffda989-d52d-40a6-9331-c428151fff3b",
    "messageType": "llm/streamChat",
    "data": {
      "messages": [
        {
          "role": "system",
          "content": "When generating new code:\n\n1. Always produce a single code block.\n2. Never separate the code into multiple code blocks.\n3. Only include the code that is being added.\n4. Replace existing code with a \"lazy\" comment like this: \"// ... existing code ...\"\n5. The \"lazy\" comment must always be a valid comment in the current context (e.g. \"<!-- ... existing code ... -->\" for HTML, \"// ... existing code ...\" for JavaScript, \"{/* ... existing code */}\" for TSX, etc.)\n6. You must always provide 1-2 lines of context above and below a \"lazy\" comment\n7. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block.\n\nExample 1:\nInput:\n.js\nimport addition from \"addition\"\n\nclass Calculator {\n  constructor() {\n    this.result = 0;\n  }\n    \n  add(number) {\n    this.result += number;\n    return this;\n  }\n}\n\nUser request: Add a subtract method\n\nOutput:\n```javascript test.js\n// ... existing code ...\nimport subtraction from \"subtraction\"\n\nclass Calculator {\n  // ... existing code ...\n  \n  subtract(number) {\n    this.result -= number;\n    return this;\n  }\n}\n```\n\nExample 2:\nInput:\n```javascript test.js (6-9)\nfunction helloWorld() {}\n```\n\nOutput:\n```javascript test.js\nfunction helloWorld() {\n  // New code here\n}\n```\n\nAlways follow these guidelines when generating code responses.\n\nWhen using tools, follow the following guidelines:\n- Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file."
        },
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "Hi"
            }
          ]
        },
        {
          "role": "assistant",
          "content": ""
        }
      ],
      "title": "GPT-4o",
      "completionOptions": {}
    }
  }
}

Error: Error parsing response body: SyntaxError: Unexpected token 'A', "Authorizat"... is not valid JSON

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.