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

V5: production.ERROR: Illuminate\Auth\Access\Response::authorize:151 This action is unauthorized. #2113

Closed
LudovicRousseau opened this issue Dec 27, 2023 · 16 comments · Fixed by #2116

Comments

@LudovicRousseau
Copy link

LudovicRousseau commented Dec 27, 2023

Ugly interface with truncated pictures

I upgraded from V4 to V5.
On the main page the connect button has no effect. So I can't access the diagnostics page.
If I enter an album I have only truncated pictures.

Upgrade to V5

I am not sure what I did wrong.
I use a custom script lychee_migrate.sh to upgrade Lychee.

#!/bin/bash

set -e

sudo rm -rf Lychee.old
mv Lychee Lychee.old
unzip Lychee.zip

# configuration
cp Lychee.old/.env Lychee

# images
mv Lychee/public/uploads Lychee/public/uploads.old
mv Lychee.old/public/uploads Lychee/public

./lychee_setup.sh

# upgrade
cd Lychee
php artisan key:generate
php artisan migrate

lychee_setup.sh is:

#!/bin/bash

set -e

dirs=". \
	.env \
	bootstrap/cache \
	database \
	database/database.sqlite \
	public/dist \
	public/dist/user.css \
	public/img \
	public/sym \
	public/uploads \
	public/uploads/import \
	storage
	storage/app \
	storage/app/public \
	storage/bootstrap \
	storage/bootstrap/cache \
	storage/debugbar \
	storage/framework \
	storage/framework/cache \
	storage/framework/cache/data \
	storage/framework/sessions \
	storage/framework/testing \
	storage/framework/views \
	storage/logs "

for d in $dirs
do
	echo $d
	chmod g+w Lychee/$d
	sudo chgrp www-data Lychee/$d
done

Output of the diagnostics [REQUIRED]

I can't access the diagnostics page because I can't login.

storage/logs/errors.log contains:

[2023-12-27 15:22:03] production.ERROR: Illuminate\Auth\Access\Response::authorize:151 This action is unauthorized.
App\Livewire\Components\Pages\Frame::mount:54 This action is unauthorized.; caused by

storage/logs/daily-2023-12-27.log has the same content.

In Firefox I also get a 404 error:

Loading failed for the <script> with source “https://images2.xxxx.xxx/livewire/livewire.js?id=f121a5df”.

On my server Lychee is installed in /Lychee not in /. So I am not really surprised to get strange errors and behavior.
The correct URL is https://images2.xxxx.xxx/Lychee/livewire/livewire.js?id=f121a5df instead.

Browser and system

  • Firefox 115.6.0
  • Debian testing for the client
  • Debian stable for the server
@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

first you can try to add to your .env:
LIVEWIRE_ENABLED=false

That should "resolve" some of your first bugs.

What is the content of your APP_URL ?

Output of the diagnostics [REQUIRED]
I can't access the diagnostics page because I can't login.

Actually you still can, the upper part (errors) of diagnostics is always accessible.
Probably at https://example.com/Lychee/diagnostics (new) for you or https://example.com/Lychee/Diagnostics (old)

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

You will also need to add the following folders in your lychee_setup.sh:

  • image-jobs
  • image-tmp

@LudovicRousseau
Copy link
Author

Great.
With LIVEWIRE_ENABLED=false I can login and my pictures are no more truncated.

I have:
APP_URL=https://images2.xxxx.xxx/Lychee/

https://images.xxxx.xxx/Lychee/diagnostics returns a 404 NotFoundHttpException error.

But with the LIVEWIRE_ENABLED=false I can login and access the Diagnostics page.

    Diagnostics
    -------
    Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/ has permissions 0775, but should have 2775
    Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb has permissions 0775, but should have 2775
    Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46 has permissions 0775, but should have 2775
    Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46/4d has permissions 0775, but should have 2775
    Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46/86 has permissions 0775, but should have 2775
    Warning: 6708 more directories with wrong permissions
    Warning: Dropbox import not working. dropbox_key is empty.
    Warning: APP_URL contains a sub-path. This may impact your WebAuthn authentication.
    Info: Latest version of PHP is 8.3
    Foreign key: access_permissions.user_id     → users.id             : CASCADE
    Foreign key: albums.parent_id               → albums.id            : RESTRICT
    Foreign key: albums.id                      → base_albums.id       : RESTRICT
    Foreign key: albums.cover_id                → photos.id            : CASCADE
    Foreign key: base_albums.owner_id           → users.id             : RESTRICT
    Foreign key: jobs_history.owner_id          → users.id             : RESTRICT
    Foreign key: photos.album_id                → albums.id            : RESTRICT
    Foreign key: photos.owner_id                → users.id             : RESTRICT
    Foreign key: size_variants.photo_id         → photos.id            : RESTRICT
    Foreign key: sym_links.size_variant_id      → size_variants.id     : RESTRICT
    Foreign key: tag_albums.id                  → base_albums.id       : RESTRICT




    System Information
    --------------
    Lychee Version (release):                5.0.0
    DB Version:                              5.0.0
    
    composer install:                        --no-dev
    APP_ENV:                                 production
    APP_DEBUG:                               false
    
    System:                                  Linux
    PHP Version:                             8.2.7
    PHP User agent:                          Lychee/4 (https://lycheeorg.github.io/)
    Timezone:                                Europe/Paris
    Max uploaded file size:                  500M
    Max post size:                           500M
    Livewire chunk size:                     12.00 MB
    Max execution time:                      200
    MySQL Version:                           10.11.4-MariaDB-1~deb12u1
    
    exec() Available:                        yes
    Imagick Available:                       1
    Imagick Enabled:                         1
    Imagick Version:                         1691
    GD Version:                              2.3.3
    Number of foreign key:                   11 found.




    Config Information
    --------------
    version:                                 050000
    check_for_updates:                       0
    sorting_photos_col:                      taken_at
    sorting_photos_order:                    ASC
    sorting_albums_col:                      max_taken_at
    sorting_albums_order:                    ASC
    imagick:                                 1
    skip_duplicates:                         0
    small_max_width:                         0
    small_max_height:                        360
    medium_max_width:                        1920
    medium_max_height:                       1080
    lang:                                    fr
    image_overlay_type:                      desc
    default_license:                         none
    compression_quality:                     90
    grants_full_photo_access:                1
    delete_imported:                         0
    mod_frame_enabled:                       1
    mod_frame_refresh:                       30
    thumb_2x:                                1
    small_2x:                                1
    medium_2x:                               1
    landing_page_enable:                     0
    site_owner:                              Ludovic Rousseau
    landing_title:                           John Smith
    landing_subtitle:                        Cats, Dogs & Humans Photography
    sm_facebook_url:                         https://www.facebook.com/JohnSmith
    sm_flickr_url:                           https://www.flickr.com/JohnSmith
    sm_twitter_url:                          https://www.twitter.com/JohnSmith
    sm_instagram_url:                        https://instagram.com/JohnSmith
    sm_youtube_url:                          https://www.youtube.com/JohnSmith
    landing_background:                      dist/cat.webp
    site_title:                              Lychee v5
    footer_show_copyright:                   1
    site_copyright_begin:                    2012
    site_copyright_end:                      2019
    footer_additional_text:                  
    footer_show_social_media:                0
    search_public:                           0
    SL_enable:                               0
    SL_for_admin:                            0
    recent_age:                              1
    grants_download:                         0
    photos_wraparound:                       1
    map_display:                             1
    zip64:                                   1
    map_display_public:                      1
    map_provider:                            Wikimedia
    force_32bit_ids:                         0
    map_include_subalbums:                   1
    update_check_every_days:                 3
    has_exiftool:                            0
    share_button_visible:                    0
    import_via_symlink:                      0
    has_ffmpeg:                              0
    location_decoding:                       1
    location_decoding_timeout:               30
    location_show:                           1
    location_show_public:                    1
    rss_enable:                              0
    rss_recent_days:                         7
    rss_max_items:                           100
    prefer_available_xmp_metadata:           0
    editor_enabled:                          1
    lossless_optimization:                   0
    swipe_tolerance_x:                       150
    swipe_tolerance_y:                       250
    local_takestamp_video_formats:           .avi|.mov
    log_max_num_line:                        1000
    unlock_password_photos_with_url_param:   0
    nsfw_visible:                            1
    nsfw_blur:                               0
    nsfw_warning:                            0
    nsfw_warning_admin:                      0
    nsfw_banner_override:                    
    map_display_direction:                   1
    album_subtitle_type:                     oldstyle
    upload_processing_limit:                 4
    new_photos_notification:                 0
    legacy_id_redirection:                   1
    zip_deflate_level:                       6
    SA_enabled:                              1
    default_album_protection:                1
    album_decoration:                        layers
    album_decoration_orientation:            row
    allow_username_change:                   1
    auto_fix_orientation:                    1
    use_job_queues:                          0
    random_album_id:                         starred
    use_last_modified_date_when_no_exif_date: 0
    ffmpeg_path:                             
    ffprobe_path:                            
    layout:                                  justified
    date_format_photo_thumb:                 M j, Y, g:i:s A e
    date_format_photo_overlay:               M j, Y, g:i:s A e
    date_format_sidebar_uploaded:            M j, Y, g:i:s A e
    date_format_sidebar_taken_at:            M j, Y, g:i:s A e
    date_format_hero_min_max:                F Y
    date_format_hero_created_at:             M j, Y, g:i:s A T
    date_format_album_thumb:                 M Y
    upload_chunk_size:                       0
    nsfw_banner_blur_backdrop:               0
    search_pagination_limit:                 1000
    search_minimum_length_required:          4
    photo_layout_justified_row_height:       320
    photo_layout_masonry_column_width:       300
    photo_layout_grid_column_width:          250
    photo_layout_square_column_width:        200
    photo_layout_gap:                        12
    display_thumb_album_overlay:             always
    display_thumb_photo_overlay:             hover

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

The /Lychee part is breaking the urls. :(

@LudovicRousseau
Copy link
Author

You will also need to add the following folders in your lychee_setup.sh:

* `image-jobs`

* `image-tmp`

I should add php artisan image-jobs?

I do not find a script image-jobs

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

No I meant in your list:

dirs=". \
	.env \
	bootstrap/cache \
	database \
	database/database.sqlite \
	public/dist \

@LudovicRousseau
Copy link
Author

I do not have image-jobs or image-tmp directory or file.

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

Ah, then they will be created as soon as you upload a picture.

@LudovicRousseau
Copy link
Author

I imported an image but still no image-jobs or image-tmp directory created.

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

Weird, maybe only if you are using the Livewire front-end.

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

BTW, here is the expected result using the Livewire front-end: https://lychee-demo.fly.dev/

@LudovicRousseau
Copy link
Author

I have some success with livewire after I modified my Apache configuration to contain:

    Alias "/livewire/" "/var/www/images2.xxxx.xxx/Lychee/livewire/"

Now the URL “https://images2.xxxx.xxx/livewire/livewire.js?id=f121a5df" returns the correct content.

But I have problems with other links like Diagnostics that redirects to https://images2.xxxx.xxx/diagnostics instead of https://images2.xxxx.xxx/Lychee/diagnostics

It looks like it is not possible to have Lychee installed in a sub-directory instead of the root when livewire is used :-(

You can close the issue as I have a working solution: disable livewire.

@kamil4
Copy link
Contributor

kamil4 commented Dec 27, 2023

Well, I'm assuming that disabling livewire is only a temporary workaround that won't be supported forever?

Personally I think it would be most unfortunate if this can't be fixed properly. In particular, I've always run Lychee in a sub-directory (whether in production or development).

@ildyria what's your take on this?

@ildyria
Copy link
Member

ildyria commented Dec 27, 2023

It would be great if serving in a sub-directory was possible. But that might be a tricky one to fix as this is most often on config side (nginx/apache) rather than backend php side.

@LudovicRousseau
Copy link
Author

Do we have a sample apache configuration for support of Lychee in a sub-folder of the URI?

@ildyria
Copy link
Member

ildyria commented Dec 28, 2023

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

Successfully merging a pull request may close this issue.

3 participants