Unexpected Error - When running a bulk mutation

Solved

Unexpected Error - When running a bulk mutation

ozzyonfire
Shopify Partner
49 2 17

I accidentally posted this in the wrong forum; original post is here: https://community.shopify.com/c/storefront-api-and-sdks/unexpected-error-when-running-a-bulk-mutatio...

 

I'm getting a weird error back for the past couple days when trying to perform a bulkOperationRunMutation. The following is what is returned from my userErrors prop

 

field: null,
message: 'Unexpected error - https://storage.googleapis.com/shopify-staged-uploads/tmp/gcs/26556956744/bulk/a5a5312b-f58c-4375-87... not valid for shop 26556956744, bucket bulk/'

I've tried creating a new private app and talking with support, but to no avail.

 

Oddly, the same function/updates work on my other shopify stores (3 of them), it's just one in particular that is returning this error. I can't seem to find any differences between them - and this same function was working last week. 

 

Has anyone come across anything similar? I'm running out of things to try.

 

Example Mutation that doesn't work:

 

mutation {
  bulkOperationRunMutation(
    mutation: "mutation call($input: ProductVariantInput!) {
      productVariantUpdate(input: $input) {
        productVariant {
          sku
          id
        }
        userErrors {
          message
          field
        }
      }
    }",
    stagedUploadPath: "https://storage.googleapis.com/shopify-staged-uploads/tmp/gcs/26556956744/bulk/a5a5312b-f58c-4375-870b-eb873eeec232/5dc446f17e6b3b001e61251c-price-update.jsonl"
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

 

Thanks!

Accepted Solution (1)
Umiko
Shopify Staff
42 8 13

This is an accepted solution.

The bulk import guide doc highlights that the `stagedUploadPath` is the path to the file of inputs. I would recommend following the doc and passing the `Key` value from the response as `stagedUploadPath` for targets facing `storage.googleapis.com`. 

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

View solution in original post

Replies 7 (7)

ozzyonfire
Shopify Partner
49 2 17

An update to this:

 

Originally this error only showed up on 1 of my 4 Shopify stores... now another store is affected. So 2 of my 4 stores are unable to process any bulk mutations...

ozzyonfire
Shopify Partner
49 2 17

Another update!

 

I think I found something. My stores that are getting the Unexpected error, all use https://storage.googleapis.com links to stage their uploads.

 

The stores that run bulk mutations fine all use https://shopify.s3.amazonaws.com to stage the .jsonl files.

 

This started happening sometime last week - right when google updated some firebase storage API permission settings. I know this because I had to go in an add some permissions to my Google Storage bucket so that it could be accessed. I had to follow the steps here.

 

It could be possible that a similar thing happened at Shopify and we're still waiting on the permission fix? Although it's hard to believe that I'm the only one reporting this issue.

Umiko
Shopify Staff
42 8 13

Hi @ozzyonfire 👋

 

The `stagedUploadPath` variable should be the path to the file in the format outlined in the example from our docs here. For targets facing `storage.googleapis.com`, the list of parameters appears to include a `key` that contains the path. 

 

27-00-2arpq-giiud

 

Using the sample mutation from your post, it will likely look closer to `tmp/gcs/26556956744/bulk/a5a5312b-f58c-4375-870b-eb873eeec232`. If the issue persists after adjusting the path, please share a `X-Request-ID` here and I can take a closer look 🙂

 

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

ozzyonfire
Shopify Partner
49 2 17

Hi Umiko, Thanks for your response!

 

When retrieving the location from the stagedUploadsCreate response I get this as my response:

 

{
  PostResponse: {
    Location: [
      'https://storage.googleapis.com/shopify-staged-uploads/tmp/gcs/26556956744/bulk/27690026-fda4-483d-9104-3c24aee42ac4/5dc446f17e6b3b001e61251c-price-update.jsonl'
    ],
    Bucket: [ 'shopify-staged-uploads' ],
    Key: [
      'tmp/gcs/26556956744/bulk/27690026-fda4-483d-9104-3c24aee42ac4/5dc446f17e6b3b001e61251c-price-update.jsonl'
    ],
    ETag: [ '"7d03f10b3e0988a15ac190133574a8a3"' ]
  }
}

 

I then use that "Location" value as the stagedUploadPath. 

I'm going over the docs and this seems like the proper approach... again, this same method works for other stores - but let me know if something doesn't look right. 

 

Here is an X-Request-ID: 2fd0505f-5845-4d79-8eac-1b31923f2f91

 

 

 

 

Umiko
Shopify Staff
42 8 13

This is an accepted solution.

The bulk import guide doc highlights that the `stagedUploadPath` is the path to the file of inputs. I would recommend following the doc and passing the `Key` value from the response as `stagedUploadPath` for targets facing `storage.googleapis.com`. 

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

ozzyonfire
Shopify Partner
49 2 17

I swear the docs changed or maybe I am just going crazy, but the Location used to work. 

 

Just tried again with the Key value and it works as expected. Thanks for the help.

 

It does look like stores are being migrated over to Google Cloud Storage from Amazon S3. So maybe things (accidentally) worked on Amazon, but not with Google. 

 

Thanks again!

crusk
Visitor
2 1 1

Yup, this is it. Kind of confusing terminology, but that you for your answer!