Automattic / Automattic/google-docs-add-on

Request failed for https://public-api.wordpress.com/rest/v1.1/sites/156141865/media/new returned code 400

Open
#112 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
169
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Hey, guys.

For some reason, my google-docs-add-on can not upload images, regardless of their extension.

The full error message I am getting is:

{"message":"Request failed for https://public-api.wordpress.com/rest/v1.1/sites/156141865/media/new returned code 400. Truncated server response: {\"error\":\"json_syntax\",\"message\":\"Invalid response from the Jetpack site\"} (use muteHttpExceptions option to examine full response).","name":"Exception","fileName":"Code (WordPress.com for Google Docs)","lineNumber":3349,"stack":"\tat Code (WordPress.com for Google Docs):3349 (request)\n\tat Code (WordPress.com for Google Docs):3422 (uploadImage)\n\tat Code (WordPress.com for Google Docs):304 (upload)\n\tat Code (WordPress.com for Google Docs):4083\n\tat Code (WordPress.com for Google Docs):3878 (renderInlineImage)\n\tat Code (WordPress.com for Google Docs):3542 (renderElement)\n\tat Code (WordPress.com for Google Docs):3524 (renderContainer)\n\tat Code (WordPress.com for Google Docs):3655 (renderParagraph)\n\tat Code (WordPress.com for Google Docs):3538 (renderElement)\n\tat Code (WordPress.com for Google Docs):3524 (renderContainer)\n\tat Code (WordPress.com for Google Docs):309 (postToWordPress)\n"}

Cheers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the image upload failure and inspect the request at Code line 3349 and uploadImage at line 3422, using the full response rather than the truncated error. Trace the call from renderInlineImage and determine whether the WordPress.com media endpoint returns valid JSON; done means image uploads succeed instead of returning the 400 json_syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wordpress
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.