edu
edu

Reputation: 85

Azure.RequestFailedException: Cannot access source document location with the current permissions. Status: 200 (OK) ErrorCode: InvalidRequest

I have two containers in Azure storage, in order to do translations

Containers

original and transcribed, they are containers, because I need to access them

I have a method, to upload my document

    public async Task<Uri> UploadToAzureBlobStorage(string FilePath) {

            ContainerClient = new BlobContainerClient(ConectionString, Constants.AZURE_CONTAINER_ORIGINAL_DOCUMENT);

            var blob = ContainerClient.GetBlobClient(Path.GetFileName(FilePath));
            await blob.UploadAsync(FilePath, true);

            return new Uri($"https://transcribemedocs.blob.core.windows.net/original/{Path.GetFileName(FilePath)}");
        }

The document gets uploaded successfully

I have declared a method for translating the document

   public static async Task TranslatorAsync(Uri sourceUrl, Uri TargetUrl, string language = "en") {

            DocumentTranslationClient client = new(new Uri(Constants.ENDPOINT), new AzureKeyCredential(Constants.KEY));

            var input = new DocumentTranslationInput(sourceUrl, TargetUrl, language);

            DocumentTranslationOperation operation = await client.StartTranslationAsync(input);

            await operation.WaitForCompletionAsync();

        }

I got this error

Azure.RequestFailedException: 'Cannot access source document location with the current permissions. Status: 200 (OK) ErrorCode: InvalidRequest

and when I go o the URL, I got this error

Error

Upvotes: 0

Views: 1136

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136306

Please change the following line of code:

return new Uri($"https://transcribemedocs.blob.core.windows.net/original{Path.GetFileName(FilePath)}");

to

return new Uri($"https://transcribemedocs.blob.core.windows.net/original/{Path.GetFileName(FilePath)}");

If you notice, you are missing a / after original.

Upvotes: 0

Related Questions