maxime1992 / dev-to-git

Publish a blog post (markdown file) to Dev.to from your command line or from CI with this CLI
MIT License
27 stars 13 forks source link

422 (Unprocessable Entity) #35

Closed Offirmo closed 3 years ago

Offirmo commented 3 years ago

I'm still trying to use dev-to-git, hoping a successful upload could fix my dev.to account?

I'm getting 422 (Unprocessable Entity)

No idea what is wrong.

Seeing https://github.com/maxime1992/dev-to-git/issues/27 I checked my cover image = I don't have one.

Also checked links to all images.

Offirmo commented 3 years ago

I plan to do a dichotomy to try to find the reason.

Offirmo commented 3 years ago

I simplified my blog post to the simplest possible:

---
published: false
title: Hello world
---

Hello world

And I'm still getting a 422.

Could it be the download feature? Could that be disabled?

Offirmo commented 3 years ago

Even after my other issue was fixed https://github.com/maxime1992/dev-to-git/issues/34

I still can't use dev-to-git, getting 422.

I downgraded to the simplest possible config, 1 post, simplest hello world and I'm still getting:

[DRAFT] Article "Hello world" encountered an error:
Error name: "HTTPError"
Error message: "Response code 422 (Unprocessable Entity)"
Error stack: "HTTPError: Response code 422 (Unprocessable Entity)
    at EventEmitter.<anonymous> (/Users/xxx/work/src/off/my.dev.to/node_modules/dev-to-git/bin/dev-to-git.umd.js:7080:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)"

No idea how to fix this.

Anyone having the same problem?

Offirmo commented 3 years ago

(edited)

when there is no change, calling dev-to-git succeeds.

when there is a change, I get a 422

toonarmycaptain commented 3 years ago

I have this self-same issue. I wonder if this is an issue at dev.to's end? Maybe they changed some detail of the (beta) API?

maxime1992 commented 3 years ago

Seems like there's been some fixes upstream: https://github.com/maxime1992/dev-to-git/issues/34#issuecomment-742850402 not entirely related but I wonder if this 422 issue is still here?

inverted-capital commented 3 years ago

Seeing same issue here. Changed nothing in config and now get 422 when trying to publish. Suspect dev.to upstream changes - sure they'll fix it soon.

Also thanks for the tool maxime1992 - we appreciate the difficulty of maintaining a tool for interacting with an API that is in beta.

maxime1992 commented 3 years ago

Also thanks for the tool maxime1992 - we appreciate the difficulty of maintaining a tool for interacting with an API that is in beta.

Thanks, I appreciate the kind words! :pray: :blush:!

I don't have much time to dedicate to this project for the time being. It's been a tough year and I've had a lot on my plate (still do).

With the little time I've got to dedicate to open source projects I'm now focusing on https://github.com/cloudnc/ngx-sub-form where we've started a major rewrite many months ago and which we'd like to release asap.

If anyone is keen to help and dig into this issue, I'd be more than happy to review a PR though! :+1:

rpsu commented 3 years ago

I've tried now using Github Action, Travis and locally running the same script, a all of them end with the same error (some very silently, though):

body: {
    error: 'article param must be a JSON object. You provided article as a NilClass',
    status: 422
  }

Based on the API description here https://docs.forem.com/api/#operation/updateArticle I am guessing the API has changed, but I'm not sure how to debug the PUT request sent to dev.to API.

rpsu commented 3 years ago

There seems to be similar issue with a Go package https://github.com/softprops/devtogo/issues/8

rpsu commented 3 years ago

oh never mind, took a while to spot this https://github.com/maxime1992/dev-to-git/pull/37

moghwan commented 3 years ago

Probably It's a missing property within the Article array as the docs saying but didn't figured out yet what is it:

{
  "error": "param is missing or the value is empty: article",
  "status": 422
}
github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.4.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

maxime1992 commented 3 years ago

Hey guys, @jmcdo29 made a PR to fix this. I got quite lazy as I had to migrate from Travis to something else (picked Github Actions) but it's now all done and @jmcdo29 PR to fix thie 422 error is now deployed :)

Let me know how it goes and if it's all working out for you :+1:

Thanks again @jmcdo29 for the PR! :clap: