16551个上传中有1个未迁移到S3。数据库'default'的S3迁移失败。

,

好的,这个问题现在已经解决了!这是我(在论坛的 Artur 的大力帮助下)是如何做到的:

to_s3_migration.rb 中,我将这个:

count = Upload.by_users.where("url NOT LIKE '#{base_url}%'").count
      if count > 0
        error_message =
          "#{count} of #{Upload.count} uploads are not migrated to S3. #{failure_message}"
        raise_or_log(error_message, should_raise)
        success = false
      end

改成了这个:

count = Upload.by_users.where("url NOT LIKE '#{base_url}%'").count
      if count > 0
        failed_uploads = Upload.by_users.where("url NOT LIKE '#{base_url}%'")
        failed_ids = failed_uploads.map(&:id)
        failed_id_list = failed_ids.join(", ")
        error_message =
          "#{count} of #{Upload.count} uploads are not migrated to S3. \n List of failed IDs: \n #{failed_id_list}; #{failure_message}"
        raise_or_log(error_message, should_raise)
        success = false
      end

然后,在 rails 控制台中,我删除了有问题的上传。现在我遇到了以下问题:

FileStore::ToS3MigrationError: 3 posts are not remapped to new S3 upload URL. S3 migration failed for db 'default'.

但我认为我遇到了一个更大的问题——编译后的资源没有上传到 S3 存储桶:

显然应该有一个 assets 文件夹,但却什么都没有。这是阻止我将 CDN 放在它前面的一切,但我想这是另一个问题,留待另一个话题讨论?

4 个赞

已更改文件:

count = Post.where("cooked LIKE '%#{cdn_path}%'").count
      if count > 0
        failed_posts = Post.where("cooked LIKE '%#{cdn_path}%'")
        id_list = failed_posts.map(&:id).join(", ")
        error_message = "#{count} 篇帖子未重新映射到新的 S3 上传 URL。\n\n失败帖子列表:\n#{id_list}\n#{failure_message}"
        raise_or_log(error_message, should_raise)
        success = false
      end

count = Post.where("cooked LIKE '%#{cdn_path}%'").count
      if count > 0
        failed_posts = Post.where("cooked LIKE '%#{cdn_path}%'")
        failed_ids = failed_posts.map(&:id).join(", ")
        failed_id_list = failed_ids.join(", ")
        error_message = "#{count} 篇帖子未重新映射到新的 S3 上传 URL。\n\n失败帖子列表:\n#{failed_id_list}\n#{failure_message}"
        raise_or_log(error_message, should_raise)
        success = false
      end

获取了三个 ID,然后进入 https://example.com/p/ID 并从 UI 中删除。然后一切顺利!

3 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.