snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

failed upload assets to s3 & image not show

Open denzfarid opened this issue 6 years ago • 10 comments

Please confirm you have done the following before posting your bug report:

Describe the bug Hello, I had an error when I tried to move assets to s3 bucket, I used the php artisan snipeit command: move-uploads, according to this directive php artisan snipeit:move-uploads https://snipe-it.readme.io/docs/configuration#optional-amazon-s3-settings

To Reproduce I have replaced the env file like this

PUBLIC_FILESYSTEM_DISK : s3_public
PRIVATE_FILESYSTEM_DISK : s3_private


# --------------------------------------------
# OPTIONAL: PUBLIC S3 Settings
# --------------------------------------------
PUBLIC_AWS_SECRET_ACCESS_KEY=xxxxx
PUBLIC_AWS_ACCESS_KEY_ID=xxxxx
PUBLIC_AWS_DEFAULT_REGION=xxxxx
PUBLIC_AWS_BUCKET=xxxxx
PUBLIC_AWS_URL=xxxxx
PUBLIC_AWS_BUCKET_ROOT=storage

# --------------------------------------------
# OPTIONAL: PRIVATE S3 Settings
# --------------------------------------------
PRIVATE_AWS_ACCESS_KEY_ID=xxxxx
PRIVATE_AWS_SECRET_ACCESS_KEY=xxxxx
PRIVATE_AWS_DEFAULT_REGION=xxxxx
PRIVATE_AWS_BUCKET=xxxxx
PRIVATE_AWS_URL=xxxxx
PRIVATE_AWS_BUCKET_ROOT=storage

Expected behavior but when I run the command, I get an error when want to upload a logo, even though I have uploaded a logo, are there any steps that I missed?

Screenshots image image

and this is when I change the asset to s3, all the images seem to fail to load image but when I right click and view the image, the image can be loaded like this image

Server (please complete the following information):

  • Snipe-IT Version latest
  • OS: ubuntu
  • Web Server: apache
  • PHP Version : 7.4.x

Error Messages

[2020-11-13 04:15:07] production.ERROR: ErrorException: Undefined offset: 2 in /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php:94
Stack trace:
#0 /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php(94): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 [internal function]: App\Console\Commands\MoveUploadsToNewDisk->handle()
#2 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\Util::unwrapIfClosure()
#5 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\Container\BoundMethod::call()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call()
#8 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute()
#9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#10 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Illuminate\Console\Command->run()
#11 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun()
#13 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run()
#14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run()
#15 /var/www/snipeit/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#16 {main}
[2020-11-13 04:15:07] production.ERROR: Undefined offset: 2 {"exception":"[object] (ErrorException(code: 0): Undefined offset: 2 at /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php:94)
[stacktrace]
#0 /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php(94): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: App\\Console\\Commands\\MoveUploadsToNewDisk->handle()
#2 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\Util::unwrapIfClosure()
#5 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\\Container\\BoundMethod::call()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\\Container\\Container->call()
#8 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute()
#9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#10 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Illuminate\\Console\\Command->run()
#11 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\\Component\\Console\\Application->doRunCommand()
#12 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\\Component\\Console\\Application->doRun()
#13 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\\Console\\Application->run()
#15 /var/www/snipeit/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#16 {main}
"}

Thank you :)

denzfarid avatar Nov 12 '20 21:11 denzfarid

S3 support is still highly experimental. We'll take a look at this.

snipe avatar Nov 12 '20 22:11 snipe

I've pushed out a possible fix onto the develop branch

snipe avatar Nov 12 '20 22:11 snipe

S3 support is still highly experimental. We'll take a look at this.

Thank you in advance

I've pushed out a possible fix onto the develop branch

perfect, I tried checkout to the develop branch and the logo problem has been resolved but there are still errors on the same line but the contents are different

image
[2020-11-13 05:52:53] production.ERROR: Undefined offset: 2 {"exception":"[object] (ErrorException(code: 0): Undefined offset: 2 at /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php:94)
[stacktrace]
#0 /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php(94): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: App\\Console\\Commands\\MoveUploadsToNewDisk->handle()
#2 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\Util::unwrapIfClosure()
#5 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\\Container\\BoundMethod::call()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\\Container\\Container->call()
#8 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute()
#9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#10 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Illuminate\\Console\\Command->run()
#11 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\\Component\\Console\\Application->doRunCommand()
#12 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\\Component\\Console\\Application->doRun()
#13 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\\Console\\Application->run()
#15 /var/www/snipeit/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#16 {main}
"}

denzfarid avatar Nov 12 '20 23:11 denzfarid

Can you do another pull from develop and see if that fixes your issue?

snipe avatar Nov 12 '20 23:11 snipe

nope, same issue this i checkout to branch develop and i pull

image image image
[stacktrace]
#0 /var/www/snipeit/app/Console/Commands/MoveUploadsToNewDisk.php(94): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: App\\Console\\Commands\\MoveUploadsToNewDisk->handle()
#2 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\Util::unwrapIfClosure()
#5 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\\Container\\BoundMethod::call()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\\Container\\Container->call()
#8 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute()
#9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#10 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Illuminate\\Console\\Command->run()
#11 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\\Component\\Console\\Application->doRunCommand()
#12 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\\Component\\Console\\Application->doRun()
#13 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\\Console\\Application->run()
#15 /var/www/snipeit/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#16 {main}
"}````

denzfarid avatar Nov 12 '20 23:11 denzfarid

Goddammit. Okay, I just pushed out a few more fixes for that script.

snipe avatar Nov 13 '20 05:11 snipe

Goddammit. Okay, I just pushed out a few more fixes for that script.

Fantastic !!, I really appreciate it, the command is perfect, and there are no errors

i am very very thank you image

this for image profile

image

denzfarid avatar Nov 13 '20 08:11 denzfarid

Glad that worked for you. Please do keep us apprised of any other weirdness you find with the S3 stuff. It's still very much a work in progress.

snipe avatar Nov 13 '20 11:11 snipe

Glad that worked for you. Please do keep us apprised of any other weirdness you find with the S3 stuff. It's still very much a work in progress.

okay, I haven't tried this s3 more, quick question, what is the difference between public and private? what is the difference between public and private?

I just tried a fresh update (I deleted existing assets on S3, and I ran again),

In this latest update, I only found private uploads and no public uploads.

image

prior to this, public assets were uploaded

this is the bucket list, once uploaded image

denzfarid avatar Nov 13 '20 14:11 denzfarid

I tried S3 with latest 5.1.3 version and only private uploads were moved to S3.

back-2-95 avatar Mar 11 '21 10:03 back-2-95