Validation Failed on projects.createCard
See original GitHub issueBug Report
Current Behavior
Creation of a project card with using content_id
raises an error.
const repo = context.repo();
const { issues, projects } = context.github;
const { pull_request } = context.payload;
const { data } = await projects.listForRepo({ ...repo });
if (data.length == 1) {
const project_id = data[0].id;
const { data: columns } = await projects.listColumns({ project_id });
if (columns.length > 0) {
try {
await projects.createCard({
column_id: columns[0].id,
content_id: pull_request.number,
content_type: 'PullRequest'
});
} catch (err) {
context.log('There is a bug');
context.log(err);
context.log(err.request);
}
}
}
13:43:26.156Z INFO event: (id=9f4d1450-e51a-11e9-9d72-8b079d4d578a, method=POST, body={"content_id":89,"content_type":"PullRequest"})
url: https://github.enterprise.net/api/v3/projects/columns/6412/cards
--
headers: {
"accept": "application/vnd.github.inertia-preview+json",
"user-agent": "octokit.js/16.30.1 Node.js/10.16.3 (Linux 4.4; x64)",
"authorization": "token [REDACTED]",
"content-type": "application/json; charset=utf-8"
}
--
request: {
"validate": {
"column_id": {
"required": true,
"type": "integer"
},
"content_id": {
"type": "integer"
},
"content_type": {
"type": "string"
},
"note": {
"type": "string"
}
}
}
13:43:26.158Z INFO event: Validation Failed (id=9f4d1450-e51a-11e9-9d72-8b079d4d578a)
HttpError: Validation Failed
at response.text.then.message (/commitlint/node_modules/@octokit/request/dist-node/index.js:66:23)
at process._tickCallback (internal/process/next_tick.js:68:7)
Expected behavior/code
A new card associated with the pull request will be created.
Environment
- Probot version(s): 9.5.0
- Node/npm version: Node 10.16.3 / npm 6.9.0
- OS: ubuntu 16.04
Additional context/Screenshots
await projects.createCard({
column_id: columns[0].id,
note: "test card",
});
works correct.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Package Registry Composer: Name is already taken ... - GitLab
and I get an error: {"message":"Validation failed: Name is already taken by another project"}. I checked this project in DB:.
Read more >Card error, unable to render, or no image: READ THIS FIRST
How do I create poll with image? Cards are validated without errors, but some cards do not display correctly. How can I make...
Read more >Automate your process with GitHub - Sylhare's blog
If you try it again, it will fail as there can only be one card per PR per board. Automatically create the card....
Read more >Errors | Marqeta Docs
If a POST or PUT request causes a validation failure, the Marqeta platform returns a response code of 400 and a body containing...
Read more >createCardToken - Stripe Developer Resources
By default, will use the Connect account that was used to instantiate the Stripe object, if specified. Throws. AuthenticationException.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gr2m, sorry, I was mistaken. I should use
pull_request.id
instead ofpull_request.number
.Issue-Label Bot is automatically applying the label
bug 🐞
to this issue, with a confidence of 0.98. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.