matthewbdaly/laravel-azure-storage

Error: This driver does not support creating temporary URLs.

nexxai opened this issue · 3 comments

Checklist

This package is just a wrapper for Flysystem's Azure storage backend to integrate it with Laravel's storage API. As such, many problems users may experience with it may actually be issues with Flysystem, the Azure driver for Flysystem, or Microsoft's PHP SDK. To help eliminate these issues, please confirm the following:

  • I'm able to instantiate a Flysystem instance using the same credentials as passed to this package.
  • The Flysystem instance works as expected, and the bug I am reporting is not reproducible when interacting directly with Flysystem
  • I can instantiate the Microsoft Azure PHP SDK successfully and can interact with my file successfully using that

Describe the bug
Getting the above error (This driver does not support creating temporary URLs.) when doing something basic like this:

use Illuminate\Support\Facades\Storage;

Route::get('test/{file}', function ($file) {

    $path = "$file";
    $url = Storage::disk('azure')->temporaryUrl($path, 60);
    return $url;

}

The entry in filesystems.php:

        'azure' => [
            'driver'    => 'azure',
            'name'      => env('AZURE_STORAGE_NAME'),
            'key'       => env('AZURE_STORAGE_KEY'),
            'container' => env('AZURE_STORAGE_CONTAINER'),
            'url'       => env('AZURE_STORAGE_URL'),
            'prefix'    => env('AZURE_STORAGE_PREFIX'),
            'retry'     => [
                'tries' => 3,
                'interval' => 500,
                'increase' => 'exponential',
            ],
        ],

To Reproduce
See code above

Expected behavior
That error not to appear

Screenshots
Screen Shot 2022-03-28 at 6 29 08 PM

Desktop (please complete the following information):

  • OS: macOS 12.3
  • Browser Safari
  • Version 15.4

Additional context
Unsure of any other additional context I can offer but happy to answer any questions to clarify things.

Sorry I've not been able to get round to this before - offline stuff and work has kept me very busy of late.

That error message seems very odd. Not all drivers for the Laravel storage facade support temporary URLs anyway, and that error is thrown by the storage abstraction if the method getTemporaryUrl() isn't implemented - see https://github.com/laravel/framework/blob/9.x/src/Illuminate/Filesystem/FilesystemAdapter.php#L668 for the implementation of this. However, that functionality was added by #21.

So that sounds like you're using an older version of the package, from before that functionality was added, implying your Laravel version is rather old. If that's the case, then you'll need to do one of the following:

  • Upgrade your application to a supported Laravel version
  • Fork the repository for your own use and downgrade the supported Laravel version.

Hi @matthewbdaly sorry to disturb you, but it seems not possible to install on last Laravel version :

Problem 1
    - matthewbdaly/laravel-azure-storage[1.6.2, ..., 1.6.3] require league/flysystem-azure-blob-storage ^1.0 -> satisfiable by league/flysystem-azure-blob-storage[1.0.0].
    - Conclusion: don't install league/flysystem-azure-blob-storage 1.0.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v9.12.1 (conflict analysis result)
    - Conclusion: don't install laravel/framework v9.12.2 (conflict analysis result)
    - Conclusion: don't install laravel/framework v9.13.0 (conflict analysis result)
    - Root composer.json requires matthewbdaly/laravel-azure-storage ^1.6.0 -> satisfiable by matthewbdaly/laravel-azure-storage[1.6.0, 1.6.1, 1.6.2, 1.6.3].
    - Conclusion: don't install one of league/flysystem-azure-blob-storage[0.1.6], league/flysystem[3.0.9] | install league/flysystem[1.1.9] (conflict analysis result)
    - Conclusion: don't install league/flysystem 1.1.9 (conflict analysis result)
    - Conclusion: don't install one of league/flysystem-azure-blob-storage[0.1.6], league/flysystem[3.0.19] (conflict analysis result)
    - matthewbdaly/laravel-azure-storage[1.6.0, ..., 1.6.1] require league/flysystem-azure-blob-storage ^0.1.6 -> satisfiable by league/flysystem-azure-blob-storage[0.1.6].
    - laravel/framework[v9.2.0, ..., 9.x-dev] require league/flysystem ^3.0 -> satisfiable by league/flysystem[3.0.0, ..., 3.x-dev].
    - Conclusion: don't install league/flysystem 3.0.5 (conflict analysis result)
    - Root composer.json requires laravel/framework ^9.2 -> satisfiable by laravel/framework[v9.2.0, ..., 9.x-dev].

@ubrette Sorry I wasn't able to get around to this earlier.

It looks like you're trying to install an older version. You need to use 2.0 or greater to work with Laravel 9. I've just tried 2.0 with Laravel 9 on PHP 8.1 and that works fine. If you still can't get it working, please open a new ticket, and ensure you complete the checklist at the top.