Azure / azure-storage-php

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

"Call to a member function getStatusCode() on null" on ConnectException with RetryMiddlewareFactory #280

Open dcruceanu opened 3 years ago

dcruceanu commented 3 years ago

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

Queue service

Which version of the SDK was used?

"microsoft/azure-storage-queue": 1.3.1 "microsoft/azure-storage-table": 1.1.2 "microsoft/azure-storage-blob": 1.5.0

What's the PHP/OS version?

php 7.3 Debian 4.9

What problem was encountered?

I am receiving in RetryMiddlewareFactory.php line 179: Call to a member function getStatusCode() on null

sheethal-santhosh commented 3 years ago

@dcruceanu have you got a solution for this? @XiaoningLiu As I was trying to do a work around for #279 without commenting $options->setIsStreaming(true) in getBlobAsync, I tried to add the retry middleware with the code below,

    $connectionString = 'xxxx';
    $retryMiddleware = RetryMiddlewareFactory::create(
        RetryMiddlewareFactory::GENERAL_RETRY_TYPE, 
        3,  
        1000,  
        RetryMiddlewareFactory::EXPONENTIAL_INTERVAL_ACCUMULATION, 
        true 
    );
    $optionsWithMiddlewares = [
                                    'middlewares' => [
                                        $retryMiddleware
                                    ],
                                ];
    $blobRestProxy = BlobRestProxy::createBlobService($connectionString,$optionsWithMiddlewares);
    $imageblob = $blobRestProxy->getBlob("img", $imgUrl);

Now I am getting the Error: [Error] Call to a member function getStatusCode() on null.

Screen Shot 2021-02-15 at 3 15 32 pm