Shopify Graphql - Pending status for image when try to update attributes - Stack Overflow

admin2025-04-15  2

I am trying to change the filename and the alt attribute of a file using GraphQL, but Shopify responds that the image is pending.

This is my Ruby code to update a product with id gid://shopify/MediaImage/62897652531549

I want to change filename and alt attribute

client = ShopifyAPI::Clients::Graphql::Admin.new(session: ShopifyAPI::Context.active_session)

query = <<~QUERY
  mutation fileUpdate($input: [FileUpdateInput!]!) {
    fileUpdate(files: $input) {
      files {
        ... on MediaImage {
          id
          image {
            url
          }
        }
      }
      userErrors {
        message
      }
    }
  }
QUERY

variables = {
  "input": {
    "id": "gid://shopify/MediaImage/62897652531549",
    "filename": "name.jpg",
    alt: "name"

  }
}

response = client.query(query: query, variables: variables)
pp response

Response:

{"files"=>nil, "userErrors"=>[{"message"=>"File id 62897652531549 has a pending operation."}]}}

I can’t understand how to change the image status and why it has operations in pending mode.

I dont’ find any information online about this problem and how to see the operations in pending mode on my file

转载请注明原文地址:http://www.anycun.com/QandA/1744724362a86745.html