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 exposes no getTemporaryUrl() method and no custom temporaryUrlCallback is registered. Temporary (pre-signed) URLs are only meaningful for drivers that support signed access (S3, R2, GCS, etc.); the local driver does not, by default.

Solutions

  1. Switch to an S3 (or other pre-sign-capable) disk for assets that need temporary URLs.
  2. Register a custom generator: Storage::disk($name)->buildTemporaryUrlsUsing(function ($path, $expiration, $options) { ... }).
  3. If running locally, configure a callback that serves files through a signed route instead.
  4. Verify the adapter package version exposes getTemporaryUrl() (e.g., league/flysystem-aws-s3-v3).

Example fix

// before
Storage::disk('local')->temporaryUrl($path, now()->addMinutes(5));

// after: register a custom resolver
Storage::disk('local')->buildTemporaryUrlsUsing(
    fn ($path, $expiration, $options) => URL::temporarySignedRoute('files.show', $expiration, ['path' => $path])
);
Defensive patterns

Strategy: fallback

Validate before calling

if (! method_exists(Storage::disk($name)->getAdapter(), 'getTemporaryUrl')
    && empty($disk->getTemporaryUrlCallback())) {
    throw new RuntimeException("Disk [{$name}] cannot create temporary URLs.");
}

Type guard

function diskSupportsTemporaryUrl(string $name): bool {
    return method_exists(Storage::disk($name)->getAdapter(), 'getTemporaryUrl');
}

Try / catch

try {
    $url = Storage::disk($name)->temporaryUrl($path, $expiration);
} catch (\RuntimeException $e) {
    // fall back to a signed application route
    $url = URL::temporarySignedRoute('files.show', $expiration, ['path' => $path]);
}

Prevention

When it happens

Trigger: Calling Storage::disk($name)->temporaryUrl($path, $expiration) on a disk that does not support pre-signed URLs — e.g., the 'local' driver, or a custom driver without getTemporaryUrl() and without a registered callback.

Common situations: Using the local disk in non-production then deploying to S3 without swapping; custom adapter that forgot getTemporaryUrl(); Azure/AWS SDK downgrade that removed the method; calling temporaryUrl() where url() was intended.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/eb659a9cc068637f. Report an issue: GitHub.

Appendix: 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 e0f6eb3518)