matthewbdaly/laravel-azure-storage

Almost certainly user error but I am stumped

nexxai opened this issue · 11 comments

First of all, thank you for this package. If I can get it working, it will be an absolute lifesaver!

I'm currently trying to store data to an Azure Blob Storage account but keep getting

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required"

whenever I try and do anything.

In the .env file, I've added the following lines:

AZURE_STORAGE_NAME=[THE NAME OF THE STORAGE ACCOUNT]
AZURE_STORAGE_KEY=[KEY1 (TRIED SURROUNDING IT IN DOUBLE QUOTES, SINGLE QUOTATION MARKS, AND NOTHING) FROM THE SETTINGS->ACCESS KEYS PAGE ON THE ABOVE STORAGE ACCOUNT]
AZURE_STORAGE_CONTAINER=[THE CONTAINER I CREATED IN THAT ACCOUNT]

Can you clear up what I'm missing here? I'm sure it's something I'm doing wrong but I can't figure out where I could be messing up.

Thank you!

It sounds like you might have missed adding the azure section to your config/filesystem.php. See https://github.com/matthewbdaly/laravel-azure-storage/blob/master/README.md for this.

Because the config doesn't ship with a section for the Azure driver, you have to add it yourself, and unfortunately there's not really any way I know of to insert it dynamically.

No, I've added that too:

    'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL') . '/storage',
            'visibility' => 'public',
        ],

        'azure' => [
            'driver' => 'azure',
            'name' => env('AZURE_STORAGE_NAME'),
            'key' => env('AZURE_STORAGE_KEY'),
            'container' => env('AZURE_STORAGE_CONTAINER'),
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],
    ],

That's why I'm so confused; I've followed what should be pretty basic steps but it's just not having it. :(

Have you tried just hard-coding the value array in the config file? If that works it at least means it's something in the config.

Still the same error. Any other suggestions I could try? Or are there other logs I could look at that might help explain what's going on?

Have you set STORAGE_BACKEND to azure as well?

If so, maybe the problem is with the wrong values being provided, or some config on Azure. Or maybe try an earlier version as I accepted a pull request recently.

Any luck with that?

Sorry for not responding; I got super busy and must have got sidetracked. Adding the STORAGE_BACKEND env setting made no difference.

What I'm wondering is if corporate accounts have some sort of different access path than non? I can't think of any other reason why it would work for everyone but me. I saw on your blog that you don't really use this package anymore, so if that's the case, I understand and I'll do my own digging, but if you do, are you able to try setting up your own bucket and attaching to it with this package, just to confirm that it really is on my side?

What might be worth a try is seeing if you can use Flysystem directly with those credentials, since the package just integrates that with the Laravel storage backend.

If you can that would indicate an issue with the package.

One thing I want to check: I've taken screenshots of the Properties of the Storage Account and Blob Service settings; can you just confirm that these are the places I should be looking for the AZURE_STORAGE_NAME, AZURE_STORAGE_KEY, and AZURE_STORAGE_CONTAINER

azure blob storage 1
azure blob storage 2

I'll test the Flysystem suggestion momentarily.

Welp, turns out it wasn't this package at all. It was my stupid mail provider that was throwing errors. Anyways, this package works perfectly. Thank you again for your assistance.

Ah, that's a relief! Thanks for letting me know.