• Resolved tangurin

    (@tangurin)


    Hello,

    wp-stateless has connection with the bucket, I know that works. Also the permissions.

    The problem is that the url’s are wrong.
    In the media library in admin i get url’s like: “…..test-bucket/2024/03/2024/03/” multiple year and month.
    In the frontend, the url’s are still pointing to local media. Many of my images are displayed from ACF content.

    Can I just upload the images to the bucket, activate the plugin and the replace some url’s in the database?
    Is the plugin changing something in the database when running the sync? I think it’s the sync that duplicate the year/month.

    Thanks in advance

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter tangurin

    (@tangurin)

    Clarification:

    I run the sync. The image url’s in frontend are changed to e.g. “https://storage.googleapis.com/test-bucket/2024/03/2024/02/image.jpg”

    And no images has been uploaded to the bucket.

    Plugin Author Eric Sopp

    (@ideric)

    Did you manipulate your database yourself via a find and replace? Perhaps you got your find/replace string wrong.

    Thread Starter tangurin

    (@tangurin)

    No I’ve done nothing to the database my self. Should I?
    The wrong url appears after I run the sync.

    Is the sync suppose to upload the existing uploads to the bucket?

    Plugin Author Eric Sopp

    (@ideric)

    Not sure why this would happen. WP-Stateless uploads the file, and then stores the URL to the file on the attachment object. It’s a simple process.

    What do you have set as your Folder path in WP-Stateless settings?

    And what is value presented in the “Preview” field in WP-Stateless settings?

    Thread Starter tangurin

    (@tangurin)

    Okey strange.

    I’v did not change those values:

    /%date_year/date_month%/

    https://storage.googleapis.com/bucket/2024/03/lu2pxsk1-your-image-name.jpeg”

    It has only been a problem when I use sync. not when I upload a new image.
    And to be clear, when I run the sync, no images are transferred to the bucket.

    Plugin Author Eric Sopp

    (@ideric)

    Perhaps there is another plugin or your theme is somehow conflicting. Are you able to disable other plugins and do a test to confirm?

    Thread Starter tangurin

    (@tangurin)

    Hello,

    I ran a complete test now with no plugins, only my theme with my images I have locally.

    1. I start with a empty bucket. A wordpress 6.4.3 with only wp-stateless plugin activated. Mode: Stateless. File url replacement: disable. Folder: Single site /date_year/date_month/
    2. The database contains a lof of images and the uploads folder too. All images in the media library are showing from the uploads folder.
    3. I go to Media -> Stateless settings -> Sync. At “Media Library Images” I find: “Total Items: 5526”. I click do nothing else but click the button “Run”.
    4. The status bar is showing up and the queued are increasing against the total number of files and the Processed are slowly counting up, as it should.
    5. Right now when I am writing this, the processed is at “252”. If I go into the bucket at Google Console, there is no images uploaded.
    6. When I look into the media library, the images are not working because the url’s are pointed to an empty bucket, but also with wrong urls /month/date/month/date. Multiple.
      This is the url of the first image: https://storage.googleapis.com/xxx-offload-testing-bucket/2024/03/2024/03/DSC02044-scaled.jpg

    Still, there is no images in the bucket and the url’s are wrong.
    The problem is with the sync, because when I upload an image manually, it works. It uploads to the bucket and the url is correct.

    • This reply was modified 8 months ago by tangurin.
    Thread Starter tangurin

    (@tangurin)

    About the url’s.

    I tried to change the setting “folder” to only a “/”.
    Instead of /%month%/%date%/

    When I sync the url’s are correct:

    https://storage.googleapis.com/xxx-offload-testing-bucket/2024/03/DSC02080-scaled.jpg

    But unfortunately, no images are uploaded.

    Also the wp_sm_sync table is always empty.

    • This reply was modified 8 months ago by tangurin.
    Thread Starter tangurin

    (@tangurin)

    One idea for me is to set the folder setting to: /
    Then I upload all folders manually to the bucket.
    Then I run the sync to get all url’s pointed to the bucket instead of locally.———–
    The alternative is to only have the wp-stateless plugin activated and not sync at all, instead I have something like this in the functions.php

    add_filter('wp_get_attachment_url', function($url, $attachment_id) {
      $newUrl = str_replace(home_url('wp-content/uploads'), BUCKET_URL, $url);
      return $newUrl;
    }, 99, 2);

    I understand that the sync is creating a post_meta. Will this slow down the site in some way? I mean will there be a sql query for each media to get the bucket url? If that’s the reality, then I guess my second option with the add_filter() would be a better choice to improve the performance of the site.

    Please tell me what you think of these alternatives and if there will be a performance cost to use the plugin instead of add_filter.

    Thanks in advance

    Plugin Author Oleksii Bolhunovskyi

    (@obolgun)

    Hello @tangurin,

    Thank you for the provided info and tests that you made so far.
    This is very strange situation, I’ve made some tests and I’m not able to reproduce ?/%year%/%month%/ duplication for any files.

    I tried to change the setting “folder” to only a “/”.
    Instead of /%month%/%date%/

    When I sync the url’s are correct:

    https://storage.googleapis.com/xxx-offload-testing-bucket/2024/03/DSC02080-scaled.jpg

    No, this is also not correct. If the folder is set to “/” the resulting image URL should be https://storage.googleapis.com/xxx-offload-testing-bucket/DSC02080-scaled.jpg (without year/month part).

    This brings me to the idea that “2024/03” is considered as a part of the image file name. So the file name in your system is 2024/03/DSC02080-scaled.jpg but in order to work correctly it should be just DSC02080-scaled.jpg. For now I have no idea how this can happen.

    Could you please provide us the info about your system? In WordPress please go to “Tools”/”Site Health”/”Info”, next click on the “Copy site info to clipboard” button and send the result to us.

    Thanks!

    Hello, I have the same issue:
    Connected with the Google bucket
    Synced files (they are synced successfully), files in a bucket /year/month/file
    When enabling stateless mode – browser tries to get <bucket_url>/<cur_year>/<cur_month>/<year_when_file_uploaded>/<month_of_upload>/filename

    ### wp-core ###
    
    version: 6.5.3
    
    site_language: en_US
    
    user_language: en_US
    
    timezone: +02:00
    
    permalink: /%postname%/
    
    https_status: true
    
    multisite: false
    
    user_registration: 0
    
    blog_public: 1
    
    default_comment_status: open
    
    environment_type: production
    
    user_count: 5
    
    dotorg_communication: true
    
    ### wp-paths-sizes ###
    
    wordpress_path: /<site_folder_path>/htdocs
    
    wordpress_size: 122.20 MB (128140441 bytes)
    
    uploads_path: /<site_folder_path>/htdocs/wp-content/uploads
    
    uploads_size: 51.69 MB (54205226 bytes)
    
    themes_path: /<site_folder_path>/htdocs/wp-content/themes
    
    themes_size: 23.08 MB (24202681 bytes)
    
    plugins_path: /<site_folder_path>/htdocs/wp-content/plugins
    
    plugins_size: 62.57 MB (65608041 bytes)
    
    database_size: 7.75 MB (8126464 bytes)
    
    total_size: 267.30 MB (280282853 bytes)
    
    ### wp-dropins (1) ###
    
    advanced-cache.php: true
    
    ### wp-active-theme ###
    
    name: Site theme (custom)
    
    version: undefined
    
    author: art-lemon.com
    
    author_website: https://art-lemon.com/
    
    parent_theme: none
    
    theme_features: core-block-patterns, post-thumbnails, title-tag, widgets-block-editor, menus
    
    theme_path: /<site_folder_path>/htdocs/wp-content/themes/custom
    
    auto_update: Disabled
    
    ### wp-themes-inactive (5) ###
    
    Twenty Nineteen: version: 2.1, author: the WordPress team (latest version: 2.8), Auto-updates disabled
    
    Twenty Twenty: version: 1.8, author: the WordPress team (latest version: 2.6), Auto-updates disabled
    
    Twenty Twenty-One: version: 1.4, author: the WordPress team (latest version: 2.2), Auto-updates disabled
    
    Twenty Twenty-Three: version: 1.2, author: the WordPress team (latest version: 1.4), Auto-updates disabled
    
    Twenty Twenty-Two: version: 1.5, author: the WordPress team (latest version: 1.7), Auto-updates disabled
    
    ### wp-plugins-active (11) ###
    
    Advanced Custom Fields PRO: version: 6.2.9, author: WP Engine, Auto-updates disabled
    
    Classic Editor: version: 1.6.3, author: WordPress Contributors, Auto-updates disabled
    
    GTM4WP - A Google Tag Manager (GTM) plugin for WordPress: version: 1.20.2, author: Thomas Geiger, Auto-updates disabled
    
    qTranslate-XT: version: 3.15.2, author: qTranslate Community, Auto-updates disabled
    
    Remove WordPress Overhead: version: 1.5.6.1, author: Omnisite, Auto-updates disabled
    
    Simple Custom Post Order: version: 2.5.7, author: Colorlib, Auto-updates disabled
    
    WP-Stateless: version: 4.0.3, author: UDX, Auto-updates disabled
    
    WP Add Mime Types: version: 3.1.1, author: Kimiya Kitani, Auto-updates disabled
    
    WP Super Cache: version: 1.7.4, author: Automattic (latest version: 1.12.1), Auto-updates disabled
    
    Yoast Duplicate Post: version: 4.5, author: Enrico Battocchi & Team Yoast, Auto-updates disabled
    
    Yoast SEO: version: 22.6, author: Team Yoast, Auto-updates disabled
    
    ### wp-plugins-inactive (3) ###
    
    Akismet Anti-spam: Spam Protection: version: 5.3.2, author: Automattic - Anti-spam Team, Auto-updates disabled
    
    Hello Dolly: version: 1.7.2, author: Matt Mullenweg, Auto-updates disabled
    
    WP Migrate Lite: version: 2.6.10, author: WP Engine, Auto-updates disabled
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_GD
    
    imagick_module_version: Not available
    
    imagemagick_version: Not available
    
    imagick_version: Not available
    
    file_uploads: 1
    
    post_max_size: 8M
    
    upload_max_filesize: 2M
    
    max_effective_size: 2 MB
    
    max_file_uploads: 20
    
    gd_version: 2.3.3
    
    gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM
    
    ghostscript_version: 9.55.0
    
    ### wp-server ###
    
    server_architecture: Linux 6.5.0-1018-gcp x86_64
    
    httpd_software: Apache/2.4.52 (Ubuntu)
    
    php_version: 8.2.18 64bit
    
    php_sapi: apache2handler
    
    max_input_variables: 1000
    
    time_limit: 30
    
    memory_limit: 128M
    
    admin_memory_limit: 256M
    
    max_input_time: 60
    
    upload_max_filesize: 2M
    
    php_post_max_size: 8M
    
    curl_version: 7.81.0 OpenSSL/3.0.2
    
    suhosin: false
    
    imagick_availability: false
    
    pretty_permalinks: true
    
    htaccess_extra_rules: false
    
    current: 2024-05-14T08:05:36+00:00
    
    utc-time: Tuesday, 14-May-24 08:05:36 UTC
    
    server-time: 2024-05-14T10:05:33+02:00
    
    ### wp-database ###
    
    extension: mysqli
    
    server_version: 8.0.34-google
    
    client_version: mysqlnd 8.2.18
    
    max_allowed_packet: 33554432
    
    max_connections: 280
    
    ### wp-constants ###
    
    WP_HOME: undefined
    
    WP_SITEURL: undefined
    
    WP_CONTENT_DIR: /<site_folder_path>/htdocs/wp-content
    
    WP_PLUGIN_DIR: /<site_folder_path>/htdocs/wp-content/plugins
    
    WP_MEMORY_LIMIT: 40M
    
    WP_MAX_MEMORY_LIMIT: 256M
    
    WP_DEBUG: false
    
    WP_DEBUG_DISPLAY: true
    
    WP_DEBUG_LOG: false
    
    SCRIPT_DEBUG: false
    
    WP_CACHE: false
    
    CONCATENATE_SCRIPTS: undefined
    
    COMPRESS_SCRIPTS: undefined
    
    COMPRESS_CSS: undefined
    
    WP_ENVIRONMENT_TYPE: Undefined
    
    WP_DEVELOPMENT_MODE: undefined
    
    DB_CHARSET: utf8
    
    DB_COLLATE: undefined
    Plugin Author Oleksii Bolhunovskyi

    (@obolgun)

    Hello @nenych,
    A couple of questions:

    1. What is the Access Control setting for your Google Storage Bucket? Is it Fine-grained or Uniform?

    2. Also please open Edit page for any image in Image library and check Stateless section. There should be the list of image sizes with links. Is it present?

    Thanks!

    Access Control is Fine-grained
    No, in the stateless section there is nothing, only the button “Regenerate and sync with GCS” (Does not work: Check your server configuration)

    Plugin Author Oleksii Bolhunovskyi

    (@obolgun)

    Hello @nenych ,

    Thanks for the provided info and for posting you server status previously. But in addition could you please also paste the info copied from Media / Stateless Settings / Status, the Info section?

    Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Wrong url’s’ is closed to new replies.