You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building a resource uri with the default configuration will crash on CLI:
No base URI could be provided.
This probably means a call was made outside of an HTTP request and a base
URI was neither configured nor specified as $fallbackRequest.
The methods are currently only used by the resource manager Neos & Flow.
And there we could allow a backwards compatible nullable parameter which will default to the current request:
classResourceManager
{
publicfunctiongetPublicPackageResourceUri(string$packageKey, string$relativePathAndFilename, ?UriInterface$baseUri = null): string
{
$baseUri ??= $this->generateBaseUriFromHttpRequest();
// ...
}
publicfunctiongetPublicPersistentResourceUri(PersistentResource$resource, ?UriInterface$baseUri = null)
{
$baseUri ??= $this->generateBaseUriFromHttpRequest();
// ...
}
privatefunctiongenerateBaseUriFromHttpRequest(): ?UriInterface
{
// copied from the base uri provider without `Neos.Flow.http.baseUri` support$activeRequestHandler = $this->bootstrap->getActiveRequestHandler();
if (!$activeRequestHandler instanceof HttpRequestHandlerInterface) {
returnnewUri();
}
$request = $activeRequestHandler->getHttpRequest();
returnRequestInformationHelper::generateBaseUri($request);
}
}
(i left out the demonstration for ResourceManager::getPublicPersistentResourceUriByHash as its unused)
In Fusion we could start inside our prototypes to call getPublicPersistentResourceUri with the base uri of the current
request and thus make the life a little easier ;)
Building a resource uri with the default configuration will crash on CLI:
The entry point ResourceManager::getPublicPackageResourceUri
calls TargetInterface::getPublicStaticResourceUri
which will use the configured target like localWebDirectoryStaticResourcesTarget
which in case of the FileSystemTarget and FileSystemSymlinkTarget
will call the BaseUriProvider::getConfiguredBaseUriOrFallbackToCurrentRequest
which uses
$bootstrap->getActiveRequestHandler->getHttpRequest
which is not possible on CLI.Possible workarounds include:
localWebDirectoryStaticResourcesTarget.targetOptions.baseUri
tohttp://localhost:8081/_Resources/Static/Packages/
Neos.Flow.http.baseUri
tohttp://localhost:8081
getResourcesBaseUri
https://github.com/Flowpack/Flowpack.DecoupledContentStore/blob/6adb8e04246f5fc9b8471b656db7ddf131474745/Classes/Transfer/Resource/Target/MultisiteFileSystemSymlinkTarget.php#L16-L38To actually fix this issue we should pass the current base uri to the target:
The methods are currently only used by the resource manager Neos & Flow.
And there we could allow a backwards compatible nullable parameter which will default to the current request:
(i left out the demonstration for
ResourceManager::getPublicPersistentResourceUriByHash
as its unused)In Fusion we could start inside our prototypes to call
getPublicPersistentResourceUri
with the base uri of the currentrequest and thus make the life a little easier ;)
Alternative fixes
BaseUriProvider::applyBaseUriToClosure($newBaseUri, fn () => $resourcemanger->...(...))
FLOW_BASE_URI
see FEATURE: Make base URI configuration obsolete #3002getPublicStaticResourceUri
from crashing in cli con… #3314The text was updated successfully, but these errors were encountered: