Internal error on a stagedUploadsCreate Mutation

Solved
strocode
Shopify Partner
5 1 1

Hello,

 

When I try and use a staged upload mutation to upload a jsonl file, I get this response back:

=> "#<GraphQL::Client::Response:0x00007fa9fd399cd0 @Original_hash={\"errors\"=>[{\"message\"=>\"Internal error. Looks like something went wrong on our end.\\nRequest ID: c051d4e4-e0d3-4611-8323-fd70703a6e9f (include this in support requests).\", \"extensions\"=>{\"code\"=>\"INTERNAL_SERVER_ERROR\", \"requestId\"=>\"c051d4e4-e0d3-4611-8323-fd70703a6e9f\"}}]}, @Data=nil, @errors=#<GraphQL::Client::Errors @messages={\"data\"=>[\"Internal error. Looks like something went wrong on our end.\\nRequest ID: c051d4e4-e0d3-4611-8323-fd70703a6e9f (include this in support requests).\"]} @details={\"data\"=>[{\"message\"=>\"Internal error. Looks like something went wrong on our end.\\nRequest ID: c051d4e4-e0d3-4611-8323-fd70703a6e9f (include this in support requests).\", \"extensions\"=>{\"code\"=>\"INTERNAL_SERVER_ERROR\", \"requestId\"=>\"c051d4e4-e0d3-4611-8323-fd70703a6e9f\"}, \"normalizedPath\"=>[\"data\"]}]}>, @extensions=nil>"

Here are the variables for the query

{"input"=>[{"resource"=>"BULK_MUTATION_VARIABLES", "filename"=>"./tmp/staged_upload1631316638.jsonl", "mimeType"=>"text/jsonl", "fileSize"=>"8"}]}

Here is the query as it appears in my code

          client = ShopifyAPI::GraphQL.client
          staged_upload_query = client.parse <<-GRAPHQL
          mutation($input: [StagedUploadInput!]!) {
              stagedUploadsCreate(input: $input) {
                stagedTargets {
                  resourceUrl
                  url
                }
                userErrors {
                  field
                  message
                }
              }
            }
          GRAPHQL

 

I am using Ruby on Rails for this app.

0 Likes
strocode
Shopify Partner
5 1 1

This is an accepted solution.

I've located the source of the error. The query does not contain the httpMethod in its variables. The resourceUrl parameters are also missing. Here is the correct query.

 

          client = ShopifyAPI::GraphQL.client
          staged_upload_query = client.parse <<-GRAPHQL
          mutation($input: [StagedUploadInput!]!) {
              stagedUploadsCreate(input: $input) {
                stagedTargets {
                  resourceUrl
                  url
                  parameters {
                    name
                    value
                  }
                }
                userErrors {
                  field
                  message
                }
              }
            }
          GRAPHQL

 

 

0 Likes