Skip to content

RestError: Missing required query parameter: api-version #36759

@kaulsh

Description

@kaulsh
  • Package Name: @azure/ai-text-analytics
  • Package Version: 5.1.0
  • Operating system: Fedora
  • nodejs
    • version: 22.21.0
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
I'm getting this error "RestError: Missing required query parameter: api-version" when trying to use recognizePIIEntities() on TextAnalyticsClient from @azure/ai-text-analytics

To Reproduce
Steps to reproduce the behavior:

const client = new TextAnalyticsClient(
				AZURE_TEXT_ANALYTICS_ENDPOINT,
				new AzureKeyCredential(AZURE_TEXT_ANALYTICS_KEY),
			);
const inputs = [
				{
					id: '1',
					text,
					language: languageCode,
				},
			];
const results = await client.recognizePiiEntities(inputs);

Is giving me the error "RestError: Missing required query parameter: api-version"

Here's the stack trace if it helps:

RestError: Missing required query parameter: api-version
    at handleErrorResponse (/home/kaulshashank/Workspace/@score/monorepo/node_modules/.pnpm/@[email protected]/node_modules/@azure/core-client/src/deserializationPolicy.ts:255:17)
    at deserializeResponseBody (/home/kaulshashank/Workspace/@score/monorepo/node_modules/.pnpm/@[email protected]/node_modules/@azure/core-client/src/deserializationPolicy.ts:159:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

I don't see an option to provide this api-version parameter. Seems like it should be set automatically by the sdk but it doesnt seem to be happening.

Screenshots

I ran the request with the env var AZURE_LOG_LEVEL="info"

Here are the logs, hope it helps!

azure:core-client:warning The baseUri option for SDK Clients has been deprecated, please use endpoint instead.
azure:ai-text-analytics:info Request: {
  "url": "https://foundry-shashank-1-resource.services.ai.azure.com/api/projects/foundry-shashank-1/text/analytics/v3.1/entities/recognition/pii?stringIndexType=REDACTED",
  "method": "POST",
  "headers": {
    "content-type": "application/json",
    "accept": "application/json, text/json",
    "accept-encoding": "gzip,deflate",
    "user-agent": "azsdk-js-ai-textanalytics/5.1.2 azsdk-js-ai-text-analytics/5.1.2 core-rest-pipeline/1.22.2 Node/22.21.0 (Linux 6.17.7-200.fc42.x86_64; x64)",
    "x-ms-client-request-id": "854114c9-1c07-4afd-bac3-9bff375d2995",
    "ocp-apim-subscription-key": "REDACTED"
  },
  "timeout": 0,
  "withCredentials": false,
  "streamResponseStatusCodes": {},
  "enableBrowserStreams": false,
  "disableKeepAlive": false,
  "requestId": "854114c9-1c07-4afd-bac3-9bff375d2995",
  "allowInsecureConnection": false,
  "tracingOptions": {
    "tracingContext": {
      "_contextMap": {}
    }
  }
}
[12:45:24.753] DEBUG: Using Azure Text Analytics for PII redaction
azure:ai-text-analytics:info Response status code: 400
azure:ai-text-analytics:info Headers: {
  "content-length": "89",
  "content-type": "application/json",
  "apim-request-id": "72f64e22-69f9-4f27-bbb7-5a1dcee87543",
  "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
  "x-content-type-options": "nosniff",
  "x-ms-region": "East US 2",
  "date": "Thu, 27 Nov 2025 07:15:24 GMT"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Cognitive - Text Analyticscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions