Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Root' path container issue after upgrading to 3.3 / Laravel 9 #5535

Closed
bennettblack opened this issue Mar 16, 2022 · 8 comments · Fixed by #5726
Closed

'Root' path container issue after upgrading to 3.3 / Laravel 9 #5535

bennettblack opened this issue Mar 16, 2022 · 8 comments · Fixed by #5726
Labels

Comments

@bennettblack
Copy link

Bug description

I'm getting an 'Undefined array key "dirname"' error on any URI's that contain references to Digital Ocean Assets.

I've used Spatie/Ray to troubleshoot the indicated problem method in the stacktrace ContainerAssetsStore.php@getFiles().

It looks like a non-existent file is entering the method without a 'dirname' key or any other data. I manually checked the Digital Ocean Space - there are only three assets in there, and their corresponding .yaml files. They all appear in the Ray dumps. Not sure where this particular file is coming from, or why its missing the dirname key.

image

My temporary fix is just to comment out the check for the dirname key in ContainerAssetsStore.php@getFiles() and everything works fine.

image

How to reproduce

I can't exactly share my DO credentials for an issue reproduction.

  • I have assets in a Digital Ocean Space
  • Error occurs when visiting a URI with references (glide tags) to one of those assets, or when visiting assets in the control panel.

Logs

[2022-03-16 17:01:46] local.ERROR: Undefined array key "dirname" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"dirname\" at C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\ContainerAssetsStore.php:85)
[stacktrace]
#0 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(231): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'Undefined array...', 'C:\\\\Users\\\\Bennet...', 85)
#1 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\ContainerAssetsStore.php(85): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'Undefined array...', 'C:\\\\Users\\\\Bennet...', 85)
#2 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(802): Statamic\\Stache\\Stores\\ContainerAssetsStore->Statamic\\Stache\\Stores\\{closure}(Array, '')
#3 [internal function]: Illuminate\\Support\\Collection->Illuminate\\Support\\Traits\\{closure}(Array, '')
#4 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Arr.php(729): array_filter(Array, Object(Closure), 1)
#5 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Collection.php(372): Illuminate\\Support\\Arr::where(Array, Object(Closure))
#6 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(804): Illuminate\\Support\\Collection->filter(Object(Closure))
#7 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\ContainerAssetsStore.php(88): Illuminate\\Support\\Collection->reject(Object(Closure))
#8 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\ContainerAssetsStore.php(67): Statamic\\Stache\\Stores\\ContainerAssetsStore->getFiles()
#9 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\Store.php(370): Statamic\\Stache\\Stores\\ContainerAssetsStore->paths()
#10 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\ContainerAssetsStore.php(31): Statamic\\Stache\\Stores\\Store->clear()
#11 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Stores\\Store.php(43): Statamic\\Stache\\Stores\\ContainerAssetsStore->handleFileChanges()
#12 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(100): Statamic\\Stache\\Stores\\Store->index('path')
#13 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Assets\\QueryBuilder.php(49): Statamic\\Stache\\Query\\Builder->getWhereColumnKeysFromStore('article_images', Array)
#14 [internal function]: Statamic\\Assets\\QueryBuilder->Statamic\\Assets\\{closure}('article_images', 0)
#15 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Collection.php(721): array_map(Object(Closure), Array, Array)
#16 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(377): Illuminate\\Support\\Collection->map(Object(Closure))
#17 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Assets\\QueryBuilder.php(50): Illuminate\\Support\\Collection->flatMap(Object(Closure))
#18 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Assets\\QueryBuilder.php(40): Statamic\\Assets\\QueryBuilder->getKeysFromContainersWithWhere(Array, Array)
#19 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(757): Statamic\\Assets\\QueryBuilder->Statamic\\Assets\\{closure}(NULL, Array, 0)
#20 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Assets\\QueryBuilder.php(43): Illuminate\\Support\\Collection->reduce(Object(Closure))
#21 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Assets\\QueryBuilder.php(21): Statamic\\Assets\\QueryBuilder->getKeysFromContainersWithWheres(Array, Array)
#22 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(26): Statamic\\Assets\\QueryBuilder->getFilteredKeys()
#23 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Query\\Builder.php(517): Statamic\\Stache\\Query\\Builder->get()
#24 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Traits\\ForwardsCalls.php(23): Statamic\\Query\\Builder->first()
#25 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Query\\OrderedQueryBuilder.php(42): Statamic\\Query\\OrderedQueryBuilder->forwardCallTo(Object(Statamic\\Assets\\QueryBuilder), 'first', Array)
#26 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Fieldtypes\\Assets\\Assets.php(147): Statamic\\Query\\OrderedQueryBuilder->__call('first', Array)
#27 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Fields\\Value.php(47): Statamic\\Fieldtypes\\Assets\\Assets->augment(Array)
#28 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(1248): Statamic\\Fields\\Value->value()
#29 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(1184): Statamic\\View\\Antlers\\Parser->getVariableExistenceAndValue('cover_photo:alt', Object(Statamic\\Fields\\Value))
#30 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(419): Statamic\\View\\Antlers\\Parser->getVariable('cover_photo:alt', Array, '__lex_no_value_...')
#31 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(370): Statamic\\View\\Antlers\\Parser->parseStringVariableTag('cover_photo:alt', '{{ cover_photo:...', Array)
#32 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(226): Statamic\\View\\Antlers\\Parser->parseStringVariables('            <di...', Array)
#33 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(345): Statamic\\View\\Antlers\\Parser->parseVariables('            <di...', Array)
#34 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(290): Statamic\\View\\Antlers\\Parser->parseLoopInstance('            <di...', Array)
#35 [internal function]: Statamic\\View\\Antlers\\Parser->Statamic\\View\\Antlers\\{closure}(Array, 0)
#36 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Collection.php(721): array_map(Object(Closure), Array, Array)
#37 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(291): Illuminate\\Support\\Collection->map(Object(Closure))
#38 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(225): Statamic\\View\\Antlers\\Parser->parseLoopVariables('<div class=\"gri...', Array)
#39 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(177): Statamic\\View\\Antlers\\Parser->parseVariables('<div class=\"gri...', Array)
#40 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Parser.php(134): Statamic\\View\\Antlers\\Parser->parse('<div class=\"gri...', Array)
#41 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\Antlers\\Engine.php(97): Statamic\\View\\Antlers\\Parser->parseView('C:\\\\Users\\\\Bennet...', '<div class=\"gri...', Array)
#42 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\View\\View.php(139): Statamic\\View\\Antlers\\Engine->get('C:\\\\Users\\\\Bennet...', Array)
#43 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\View\\View.php(122): Illuminate\\View\\View->getContents()
#44 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\View\\View.php(91): Illuminate\\View\\View->renderContents()
#45 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\View.php(94): Illuminate\\View\\View->render()
#46 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\View\\View.php(181): Statamic\\View\\View->render()
#47 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\symfony\\http-foundation\\Response.php(391): Statamic\\View\\View->__toString()
#48 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Response.php(72): Symfony\\Component\\HttpFoundation\\Response->setContent(Object(Statamic\\View\\View))
#49 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Response.php(35): Illuminate\\Http\\Response->setContent(Object(Statamic\\View\\View))
#50 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(834): Illuminate\\Http\\Response->__construct(Object(Statamic\\View\\View), 200, Array)
#51 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(803): Illuminate\\Routing\\Router::toResponse(Object(Illuminate\\Http\\Request), Object(Statamic\\View\\View))
#52 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(725): Illuminate\\Routing\\Router->prepareResponse(Object(Illuminate\\Http\\Request), Object(Statamic\\View\\View))
#53 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#60 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#61 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#62 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#63 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#64 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#65 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#66 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#67 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#68 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(727): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#69 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(702): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#70 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(666): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#71 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(655): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#72 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(167): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#73 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#74 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Http\\Middleware\\DisableFloc.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#75 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Statamic\\Http\\Middleware\\DisableFloc->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#76 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Http\\Middleware\\CheckMultisite.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#77 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Statamic\\Http\\Middleware\\CheckMultisite->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#78 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Http\\Middleware\\CheckComposerJsonScripts.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#79 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Statamic\\Http\\Middleware\\CheckComposerJsonScripts->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#80 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\statamic\\cms\\src\\Http\\Middleware\\PoweredByHeader.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#81 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Statamic\\Http\\Middleware\\PoweredByHeader->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#82 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#83 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#84 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#85 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#86 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#87 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#88 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#89 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#90 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#91 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#92 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#93 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#94 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\fruitcake\\laravel-cors\\src\\HandleCors.php(38): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#95 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Fruitcake\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#96 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#97 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#98 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#99 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#100 C:\\Users\\Bennett Black\\Development\\swark-today\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#101 C:\\Users\\Bennett Black\\Development\\swark-today\\public\\index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#102 {main}
"}

Versions

  • PHP: 8.1.3
  • Laravel: 9.5
  • Statamic: 3.3.0 Pro

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

I'm guessing this will be related to the recent Flysystem changes in 3.3.

@staudenmeir
Copy link

staudenmeir commented Mar 24, 2022

We also ran into this issue with DigitalOcean Spaces after upgrading to Statamic 3.3.2 and Laravel 9.5.1.

Somehow, Flysystem's S3 adapter behaves differently in ^3.0 than in ^1.0: In ^3.0, listContents() always returns this "file" with the empty path from @bennettblack's first screenshot. Not sure what it's supposed to represent.

Since the path is empty, pathinfo() in AssetContainerContents::normalizeFlysystemAttributes() doesn't add the dirname to the attributes and that causes the error.

We temporarily fixed the control panel by adding || !isset($file['dirname']) to ContainerAssetsStore::getFiles():

    private function getFiles()
    {
        return $this->container()->listContents()->reject(function ($file) {
            return $file['type'] !== 'file'
                || !isset($file['dirname'])
                || $file['dirname'] === '.meta'
                || Str::contains($file['path'], '/.meta/')
                || in_array($file['basename'], ['.gitignore', '.gitkeep', '.DS_Store']);
        });
    }

@bennettblack bennettblack changed the title Issues retrieving Digital Ocean Assets after Upgrade to 3.3 'Root' path container issue after upgrading to 3.3 / Laravel 9 Mar 29, 2022
@bennettblack
Copy link
Author

As #5622 mentioned, the issue appears to only occur when a 'root' directory is specified in the filesystem config. Assuming this is related to the updated version of flysystem that Laravel 9 uses.

@staudenmeir
Copy link

We temporarily override the ContainerAssetsStore.php file in our project so we don't have edit any vendor files:

  1. Copy vendor/statamic/cms/src/Stache/Stores/ContainerAssetsStore.php to app/Statamic/Stache/Stores/ContainerAssetsStore.php and replace getFiles():
    private function getFiles()
    {
        return $this->container()->listContents()->reject(function ($file) {
            return $file['type'] !== 'file'
                || !isset($file['dirname'])
                || $file['dirname'] === '.meta'
                || Str::contains($file['path'], '/.meta/')
                || in_array($file['basename'], ['.gitignore', '.gitkeep', '.DS_Store']);
        });
    }
  1. Adjust your composer.json:
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Statamic\\": "app/Statamic/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "exclude-from-classmap": [
            "vendor/statamic/cms/src/Stache/Stores/ContainerAssetsStore.php"
        ]
    },
  1. Run composer dump.

@bennettblack
Copy link
Author

@staudenmeir Thanks for the work around!

@frankdejonge
Copy link

Hi all,

A new version of Flysystem has been releases which addresses this (or a very similar issue), has anybody tried 3.0.13 yet to see if this works without the work around? See thephpleague/flysystem#1437

@staudenmeir
Copy link

Thanks @frankdejonge, the latest release fixes the issue for me.

@bennettblack
Copy link
Author

@frankdejonge fixes the issue for me as well. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants