What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

Shopify API Upload Image: HTTPError: Response code 422 (Unprocessable Entity) using Base64 encoding.

Solved

Shopify API Upload Image: HTTPError: Response code 422 (Unprocessable Entity) using Base64 encoding.

blanklob
Shopify Partner
14 2 2

I'm trying to upload an image via the Shopify REST Admin API Product Image ressource but I always get this error

Also, the image is jpg 2048x2048 100kb compressed using Mozjpeg algorithme, the attachment URL has only the binary encoding it doesn't have the data:base... attribute at the beginning, I tried everything but I always get that error I changed sizes formats ect..

 

code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1667651339658,
    socket: 1667651339658,
    lookup: 1667651339659,
    connect: 1667651339708,
    secureConnect: 1667651339731,
    upload: 1667651339843,
    response: 1667651340567,
    end: 1667651340569,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 49,
      tls: 23,
      request: 112,
      firstByte: 724,
      download: 2,
      total: 911
    }
  }
}

 This is so frustrating because I have generated the image to my file system and it works also the base64 code that was used in the attachment param was valid and verified checked it in the browser, what Am I missing?

Youness Id bakkasse | Autrement 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution

Accepted Solution (1)

blanklob
Shopify Partner
14 2 2

This is an accepted solution.

Haha it worked I can't believe I misspelled attachment to attachement in my params even though I'm using Typescript.

Youness Id bakkasse | Autrement 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution

View solution in original post

Reply 1 (1)

blanklob
Shopify Partner
14 2 2

This is an accepted solution.

Haha it worked I can't believe I misspelled attachment to attachement in my params even though I'm using Typescript.

Youness Id bakkasse | Autrement 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution