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

500 Server error when trying to access admin panel #5822

Open
mcirami opened this issue Dec 6, 2023 · 3 comments
Open

500 Server error when trying to access admin panel #5822

mcirami opened this issue Dec 6, 2023 · 3 comments

Comments

@mcirami
Copy link

mcirami commented Dec 6, 2023

Laravel version

10.10

PHP version

8.1

Voyager version

1.7

Database

8.0

Description

I'm using s3 in my voyager Storage Config. I get a 500 server error when trying to access /admin this is the message in my log:
Found 1 error while validating the input provided for the GetObject operation:
[Key] expected string length to be >= 1, but found string length of 0 {"view":{"view":"/var/www/linkpro-new/vendor/tcg/voyager/resources/views/media/manager.blade.php"

just to test, I went into that file and commented out lines 8-10 and I was able to get past the error and bring up the admin panel. This is what I commented out:
<template v-if="fileIs(file, 'image')"> <div class="img_icon" :style="imgIcon('{{ Storage::disk(config('voyager.storage.disk'))->url('/') }}'+file)"></div> </template>

Steps to reproduce

Set 's3' as the Storage Config in voyager config file. Go to /admin and login.

Expected behavior

Be able to use 's3' as my storage config and pull up the admin panel without any errors. This has worked up until now.

Screenshots

No response

Additional context

I just upgraded to 1.7 but this was happening before I even upgraded.

@Emerica
Copy link
Contributor

Emerica commented Dec 6, 2023

ed7bdb0

This appears to have been looked at/updated in the past for 1.6.
It's trying to get an icon url from S3 by dynamically mashing together php configs with vue's loop variables.
S3 is complaining that the filename key given is empty. Unless you have/had a pre 1.6 template that's still cached?

What OS is this on?
What do you have in your S3 config? (Without exposing credentials of course)
Do you have either of the following set?
'root' => "/" (Maybe try with or without this)
'directory_separator' => '/' (Might be needed on Windows?)

Seems there is similar issues
laravel/framework#42136
->
laravel/framework#41964
https://github.com/thephpleague/flysystem-aws-s3-v3/issues/293

You're also contradicting a bit "This has worked up until now." and " but this was happening before I even upgraded."
If emptynick had it "working" I have no reason to doubt it was for him, so I gotta lean towards a configuration difference possibly?

@mcirami
Copy link
Author

mcirami commented Dec 6, 2023

so I didn't have 'root' => "/" in there. I added that and now admin comes up but it strips the first letter of the path like one of the posters said.

I'm on a Mac, My S3 config contains:
'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'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 'throw' => false, 'root' => '/'

@mcirami
Copy link
Author

mcirami commented Dec 6, 2023

alright, I figured it out. the AWS_URL url was missing from my env file. didn't need that root after all. I'm just using the bucket path as the AWS_URL. Admin and all images are working now.

Thank you for you help!

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

No branches or pull requests

2 participants