Azure / azure-storage-php

Microsoft Azure Storage Library for PHP
MIT License
217 stars 198 forks source link

Missing header 'x-ms-blob-type' when calling `createFile` and `createFileFromContents` #295

Open bimsonz opened 3 years ago

bimsonz commented 3 years ago

Which service(blob, file, queue, table) does this issue concern?

File

Which version of the SDK was used?

1.2.4

What's the PHP/OS version?

PHP 7.4 Mac OSX BigSur

What problem was encountered?

Error, missing required header x-ms-blob-type

Steps to reproduce the issue?

Using a FileEndpoint and SASToken connection string;

Have you found a mitigation/solution?

Yes,

Add

        $this->addOptionalHeader(
          $headers,
          Resources::X_MS_BLOB_TYPE,
          'BlockBlob'
        );

to createFileAsync

Is there a failing request ID related to this problem returned by server? What is it?

1216acd1-101e-0018-2f52-642e29000000

What is the storage account name and time frame of your last reproduce? (UTC YYYY/MM/DD hh:mm:ss)

2021-06-18T14:59:36.7330482

(If you think some of the information should not be shared publicly, you can e-mail the main Microsoft contributors of the repository instead.)

katmsft commented 3 years ago

My guess is that you mistakenly used file service for ADLS gen 2 service, which is not officially supported by this SDK. You can try to use blob service instead.