Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

StageUploads returning bogus url when uploading the data

StageUploads returning bogus url when uploading the data

Schmidtc63
Shopify Partner
105 14 37

After creating a staged upload rquest, then creating and posting the form data to the returned url from the staged upload request, I should be getting back a valid url in the form of: "tmp/21759409/bulk/89e620e1-0252-43b0-8f3b-3b7075ba4a23/bulk_op_vars" or some such thing.

 

What I'm getting back is something like this: (reading the request.responseText)

 

 

https://storage.googleapis.com/shopify-staged-uploads/tmp/gcs/63530000000/bulk/00000000-0a40-4cf7-82a3-728ce3f5a17f/bulk_op_varsshopify-staged-uploadstmp/gcs/63530000000/bulk/00000000-0a40-4cf7-82a3-728ce3f5a17f/bulk_op_vars"89b30910d683b71035d546e570f0bdcd"

 

 

What do I do with this so I can submit a mutation:

 

mutation {
  bulkOperationRunMutation(
    mutation: "mutation call($input: ProductInput!) { productCreate(input: $input) { product {id title variants(first: 10) {edges {node {id title inventoryQuantity }}}} userErrors { message field } } }",
    stagedUploadPath: "tmp/21759409/bulk/89e620e1-0252-43b0-8f3b-3b7075ba4a23/bulk_op_vars") {
    bulkOperation {
      id
      url
      status
    }
    userErrors {
      message
      field
    }
  }
}
Reply 1 (1)

Umiko
Shopify Staff
42 8 14

Hi @Schmidtc63 👋

 

The `stagedUploadPath` field is the path to the file of inputs, and not necessarily a URL. The response from `stagedUploadsCreate` includes a list of parameters with a `key` that contains the path as highlighted in the guide here:

13-47-id5qd-gqwg0

 

I would recommend following the guide and passing the `key` value from the response as `stagedUploadPath` with `bulkOperationRunMutation`.

 

Hope that helps!

 

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog