laravel/framework · error · RuntimeException
This driver does not support creating temporary URLs.
Error message
This driver does not support creating temporary URLs.
What it means
Thrown by FilesystemAdapter::temporaryUrl() when the adapter has no getTemporaryUrl() method and no temporaryUrlCallback was registered. Temporary (pre-signed) URLs are only meaningful for cloud stores like S3; the call fails fast for adapters that cannot produce them.
Source
Thrown at src/Illuminate/Filesystem/FilesystemAdapter.php:883
* @param \DateTimeInterface $expiration
* @param array $options
* @return string
*
* @throws \RuntimeException
*/
public function temporaryUrl($path, $expiration, array $options = [])
{
if (method_exists($this->adapter, 'getTemporaryUrl')) {
return $this->adapter->getTemporaryUrl($path, $expiration, $options);
}
if ($this->temporaryUrlCallback) {
return $this->temporaryUrlCallback->bindTo($this, static::class)(
$path, $expiration, $options
);
}
throw new RuntimeException('This driver does not support creating temporary URLs.');
}
/**
* Get a temporary upload URL for the file at the given path.
*
* @param string $path
* @param \DateTimeInterface $expiration
* @param array $options
* @return array
*
* @throws \RuntimeException
*/
public function temporaryUploadUrl($path, $expiration, array $options = [])
{
if (method_exists($this->adapter, 'temporaryUploadUrl')) {
return $this->adapter->temporaryUploadUrl($path, $expiration, $options);
}
View on GitHub (pinned to bd6b5437e6)
Solutions
- Use an S3 (or other cloud) disk that supports pre-signed URLs.
- Register a builder: Storage::disk('custom')->buildTemporaryUrlsUsing(fn($path,$exp,$opts) => ...).
- Guard with $disk->providesTemporaryUrls() before calling temporaryUrl().
- For local disks, generate a signed URL via a route + middleware instead.
Example fix
// before - local disk cannot issue temporary urls
$url = Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));
// after
if (Storage::disk('local')->providesTemporaryUrls()) {
$url = Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));
} else {
// route-based signed url fallback
$url = URL::temporarySignedRoute('file.show', now()->addMinutes(5), ['path' => 'file.txt']);
} Defensive patterns
Strategy: validation
Validate before calling
$disk = Storage::disk($name);
if (! $disk->providesTemporaryUrls()) {
// no presigned url support - route-based signed url fallback
return URL::temporarySignedRoute('file.show', $expiration, ['path' => $path]);
}
return $disk->temporaryUrl($path, $expiration); Type guard
function diskSupportsTemporaryUrls(\Illuminate\Filesystem\FilesystemAdapter $disk): bool
{
return $disk->providesTemporaryUrls();
} Try / catch
try {
return Storage::disk($name)->temporaryUrl($path, $expiration);
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'temporary URLs')) {
// fallback: signed route or 404
return URL::temporarySignedRoute('file.show', $expiration, ['path' => $path]);
}
throw $e;
} Prevention
- Guard with providesTemporaryUrls() before calling temporaryUrl().
- Use S3/cloud disks where presigned URLs are required.
- Register buildTemporaryUrlsUsing() for custom adapters.
When it happens
Trigger: Calling Storage::disk($name)->temporaryUrl($path, $expiration) on a disk whose adapter lacks getTemporaryUrl (e.g. local, ftp, sftp, or a custom adapter) and where buildTemporaryUrlsUsing() was not called.
Common situations: Calling temporaryUrl() on a local disk in tests; using a generic adapter without pre-signed URL support; forgetting to register a callback for a custom cloud adapter.
Related errors
- This driver does not support creating temporary upload URLs.
- This driver does not support retrieving URLs.
- Driver [{$driver}] is not supported.
- This driver does not support creating temporary URLs.
- Database file at path [{$path}] does not exist. Ensure this
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/eb659a9cc068637f.json.
Report an issue: GitHub.