GitHub API : create pull-request that already exists should not throw exception - exception

GitHub API
Attempting to create a pull-request on a branch where a pull-request already exists will throw 422 Unprocessable Entity
Is it possible to instruct GitHub API to instead return success code ?

Is it possible to instruct GitHub API to instead return success code ?
The GitHub API itself, no.
But your script could, on 422 error when creating a PR, then check if the PR exists already, and if yes, return a success code out of that PR creation function.
As the OP BaltoStar comments:
more simply just check the response error message and if matches text for PR already exists then return success code.

Related

Problem downloading package from git actions, results in mangled URL

In our git actions output for testing our custom R package (hosted on github), we're experiencing an error during execution:
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://api.github.com/repos/***/CirceR/contents/DESCRIPTION?ref=HEAD'
Calls: saveRDS ... github_DESCRIPTION -> download -> base_download -> base_download_headers
Execution halted
Error: Process completed with exit code 1.
The main repo is here: https://github.com/OHDSI/CohortGenerator
The github actions report is here: https://github.com/OHDSI/CohortGenerator/runs/3294257207?check_suite_focus=true
The referenced package CirceR is found here: https://github.com/ohdsi/circer
Our main question is: is it normal for the requested URL for the DESCRITPION file to be masked with the *** as in: cannot open URL 'https://api.github.com/repos/***/CirceR/contents/DESCRIPTION?ref=HEAD'
If we change the *** to the actual organization OHDSI for this URL the request works, so is it possible the URL is being mangled?
We've tested loading each individual package locally and this error doesn't occur, so we think it's localized to github actions.
I believe the output is trying to shorten the string so you can see how it starts, and how it ends, but not the middle...for readability purposes. My issue was I wanted the entire contents of the string (other errors in 'shorter' repository names gives the full URL). So, I believe this truncation is by design.
To solve the underlying issue, I had to specify a GIT_PAT to use to invoke the API and that cleared out the error I was getting.

Model derivative translate job giving status code 409 (CONFLICT)

How to fix status code 409 for translate job.
There are two types of problems I am facing.
1. Sometimes API returns error status code 409(conflict)
2. Sometimes it continuously gives in progress status and never completes or fails even.
Once any of the above error occurs, any subsequent job requests starts failing with error code 409.
We are trying node js API for translating job using following code.
let translateResult = derivativesAPI.translate(job, { 'xAdsForce': true }, forgeSvc.requestOAuth2TwoLeggedOBJ(), accessToken);
First try to delete manifest for the stuck/pending request file,
If that doesn't works , last option is to delete the bucket with pending/stuck translation request and then try again.
As per documentation, the 409 means:
The request conflicts with a previous request that is still in progress
As you mentioned a previous request failed, but is pending on our system and causes this conflict. Is that happening consistently with a file? Or random? When it fails (or hangs), what's the manifest? Finally, can you share a problematic URN?
EDIT: the file is working now and we'll keep investigating this.

Autodesk Forge register job conflict

When POSTing to https://developer.api.autodesk.com/viewingservice/v1/register I sometiems receive the following error:
{
Diagnostic: The request is rejected as it conflicts with a previous request that is in-progress.,
registerKeys: {},
Result: Conflict
}
How can I find out which job is already in progress so that I can track its progress and get its result?
First, this is the old API, you need to consider using the ModelDerivtive API instead (ie https://developer.autodesk.com/en/docs/model-derivative/v2)
Like Xiaodond said there is no API to collect all jobs currently processing on your account. You need to request each URN manifest to determine how many jobs runs on this model as know you can translate to SVF, but also export to other formats such as obj, stl, ... when it is possible. Manifest end point and documentation here - https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-GET/
Last, we are working on a webhook solution which will be a better solution as a Webhook will call you back when a job is starting and completes. Webhooks aren't yet available at the time of this post, but you should be notified via the developer newsletter when it will be on production.
Hope that helps,

Firebase "Error: Key creator was undefined. Cannot pass undefined in JSON. Use null instead."

I am using angularFire 0.8.2 for an app I am building. The app is based on thinkster.io's angular-firebase tutorial. The problem that I am facing is at the point where I have to create a custom user profile and and access the data stored in it. Especially, I am not able to make a post once I am logged in as a user.
I reviewed the error several times and kept getting the following error:
Error: Key creator was undefined. Cannot pass undefined in JSON. Use null instead.
The stack trace points to a service that was created to allow for post creations.
Here is the code:
var Post = {
all: posts,
create: function (post) {
return posts.$add(post);
},
get: function (postId) {
return $firebase(ref.child('posts').child(postId)).$asObject();
},
delete: function (post) {
return posts.$remove(post);
}
};
I looked at solutions provided for this same problem but they were not very helpful. I am only guessing the problem has something to do with the $add() method above. Can anyone help?
I know this was asked over a year ago however I thought I'd still add some help. My resolution was rather simple so maybe it will help future folks. The reason you see this message is because you have an undefined variable somewhere in your code/object you are attempting to $add. Firebase will reject the entire $add object if there are any undefined variables in your object's properties. Hope this helps.
In short there is really no error. When you followed the tutorial, the initial account you created had no username field and hence you did not give any. Now the updated code needs one and there is none. Just try creating a new account and post a new link. You won't see that error.

Update record in ServiceNow by passing JSON object in the URL

I am trying to update a record in a ServiceNow instance (running Calgary) using the JSON Web Service, but unfortunately it is not happening.
I am able to insert the record but the update operation doesn't happen.
The call in the Developer tools of chrome (Network section) looks good (could see the url and JSON object bound with data)
Here's the code snippet with the URL I'm testing:
var url = 'https://<instance name>.service-now.com/u_test_employee.do?JSON&sysparm_query=u_number=EMP0001102&‌​sysparm_action=update'
var responsePromise = $http.post(url, dataObj, {});
Any ideas or suggestion is appreciated.
Probable cause for failure of update operation might be missing ACLs. The table which you are trying to update need to have table level write ACL otherwise by default no write (update) operations are allowed