Closed TheHolyWaffle closed 9 years ago
Same here
After some debug, I think it is because commit.getAuthor()
and commit.getCommitter()
are null
I believe so the same. Maybe it needs a setAuthor
and setCommitter
here : SiteMojo.java#L422-L424
Hi
I have the same issue, did u fix it? Where do I place the setAuthor and/or commiter?
Haven't fixed it as I'm not familiar with Mojo's at all. I hope someone else can take a look at this.
@TheHolyWaffle not fixed neither. I think the mojo can indeed ask for a commiter, but for compatibility purpose, I think the fix should rather be in the egit library (ie check if commiter / author is null before adding to JSON send to github API)
See also #70
Something has changed on Github server side, since everything worked fine three days ago. Maybe we should email them and ask for help?
@yegor256 contacted us via support and I sent him an email in which I explained what I believe is the issue here.
I'm guessing that the process is creating Git trees via the Git Trees API:
https://developer.github.com/v3/git/trees/#create-a-tree
Notice that this API takes a base_tree as input, which should be a SHA of a tree object. However, up until recently the API was more forgiving about this field. Specifically, if you passed in a SHA of a commit (and not a SHA of a tree), the API detected this and fetched the SHA of the tree which the commit pointed to and used that as input. In other words, the API handled undocumented input in an expected way.
Recently, this behavior changed in the way that the API no longer supports this undocumented behavior. The error which the API is returning in this case is currently not very helpful (a 409 indicating that there's a problem with the repository), and that's a bug which will be fixed soon. Still, the process which is interacting with the API should be passing in the correct value as the base_tree -- it should be a SHA of a tree object, not a SHA of a commit object, as documented.
I'm really sorry that this is causing problems for you. Since this change didn't affect documented behavior, we didn't blog about it in advance.
@cescoffier @kevinsawicki -- my Java is weak, so heads up on this in case you can fix this or want to accept a pull request from someone in the community.
Hello @izuzak
Thanks for posting here. The issue we have does not seem to be what your describe. My debug run lead me to a 422 error code, not a 409
Thanks @bguerin! Can you post the full request-response pair which is causing problems (an equivalent of a curl -v call)? That would be helpful in investigating this since the output above doesn't contain that information. Thanks!
(My hunch: I'm guessing that the 422 happens when the process tries to create a commit based on the response from a previously failed call to create a Git tree.)
Hey pplz,
I had the same error and fixed it by adding author and committer to the commit object. I am using the egit java client and via debugging found that it will send null values in the params to the github api if they are not set. Per the docs author and committer have the same keys. https://developer.github.com/v3/git/commits/
To note, when not initialized the author objects is sent with blank strings for email and name and null for date. The committer is simply sent as null.
hope this helps.
A snippet of my fix:
ex:
Commit commit = new Commit();
commit.setMessage(CommitTitle);
commit.setTree(tree);
CommitUser user = createCommitUser();
commit.setAuthor(user);
commit.setCommitter(user);
List
public CommitUser createCommitUser(String email, String name) {
CommitUser cUser = new CommitUser();
cUser.setEmail(email);
cUser.setName(name);
Format formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
Calendar now = Calendar.getInstance();
cUser.setDate(now.getTime());
return cUser;
}
Also, thanks @izuzak for the debug help and quick response. I had the 409 issue as well as the 422 error. The 409 was per me using the incorrect sha value.
The 422 nil error was the author and committer issue (as described above).
To note, this is what the params looked like, when not instantiating the author and committer on the commit object. { "message": "Update", "author": { "name": "", "email": "", "date": null }, "parents": [ "5bdec286c41258e16f1df7051c3df399e7080831" ], "tree": "69f6ea6c5c023e3d2af9cb3eb0dfa10e31765f55" "committer": null }
Ahhh, thanks @dgreenfield0 :heart:! Seems like this indeed isn't caused by the Git Trees API change after all, as @bguerin mentioned. A few other users were affected by those stricter validations today, so I jumped the :gun: on this one. (Also, I only read the initial issue, not the other comments in which it was already figured out what the problem was -- really sorry about that and for the false alarm.)
So, shall we submit a pull request to this maven plugin? What is the plan now? :)
Hi,
Just submit a PR, will have a look to it.
Clement
On 31 août 2014 at 09:14:59, Yegor Bugayenko (notifications@github.com) wrote:
So, shall we submit a pull request to this maven plugin? What is the plan now? :)
— Reply to this email directly or view it on GitHub.
This pull request fixes the problem: https://github.com/github/maven-plugins/pull/71
BTW, if you need help of deploying to Maven Central, this method may be helpful: http://www.yegor256.com/2014/08/19/how-to-release-to-maven-central.html
indeed, guys, would be awesome to fix this ASAP. many people are suffering...
Upgrading to 0.10-SNAPSHOT this morning made some progress but doesn't completely resolve the issue. The new error message is:
Expected data to be of type "string"; value was: nil. (422)
Hopefully the full stack trace is helpful?
Expected data to be of type "string"; value was: nil. (422)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating commit: Invalid request.
Expected data to be of type "string"; value was: nil.
Expected data to be of type "string"; value was: nil. (422)
at com.github.maven.plugins.site.SiteMojo.execute(SiteMojo.java:460)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.eclipse.egit.github.core.client.RequestException: Invalid request.
Expected data to be of type "string"; value was: nil.
Expected data to be of type "string"; value was: nil. (422)
at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:552)
at org.eclipse.egit.github.core.client.GitHubClient.sendJson(GitHubClient.java:643)
at org.eclipse.egit.github.core.client.GitHubClient.post(GitHubClient.java:757)
at org.eclipse.egit.github.core.service.DataService.createCommit(DataService.java:397)
at com.github.maven.plugins.site.SiteMojo.execute(SiteMojo.java:454)
... 21 more
Happy to help out testing snapshots as they are updated / made available.
Cheers
-- Brian
@brianoliver do the commands git config --get-all user.email
and git config --get-all user.name
give you the user credentials you use for this repository?
if not you should set them using git config
Short answer: Yes. Both commands return the correct user.email and user.name (I use git config).
Anything else I can try?
PS: My user name contains a space.
Anything else I can try?
sorry don't know atm. Assuming you build an up-2-date snapshot. does running with -X
git any hints?
@brianoliver i solved this issue by setting dryRun=true
but i have another problem it doesn't do the upload (SHA-1 is null) [INFO] Creating commit with SHA-1: null [INFO] Updating reference refs/heads/gh-pages from ed59cc4d597a51284ccf2726c867c2c90da91bc5 to null
is my configuration wrong? Its my first time using the plugin, great timing!
Updated to the latest snapshot. Tried using dryRun, which in fact isn't a solution as I don't want a "dry run". Same issue:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.github:site-maven-plugin:0.10-SNAPSHOT:site (default) on project oracle-tools-site: Error creating commit: Invalid request.
Expected data to be of type "string"; value was: nil.
Expected data to be of type "string"; value was: nil. (422)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating commit: Invalid request.
Expected data to be of type "string"; value was: nil.
Expected data to be of type "string"; value was: nil. (422)
at com.github.maven.plugins.site.SiteMojo.execute(SiteMojo.java:460)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.eclipse.egit.github.core.client.RequestException: Invalid request.
Expected data to be of type "string"; value was: nil.
Expected data to be of type "string"; value was: nil. (422)
at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:552)
at org.eclipse.egit.github.core.client.GitHubClient.sendJson(GitHubClient.java:643)
at org.eclipse.egit.github.core.client.GitHubClient.post(GitHubClient.java:757)
at org.eclipse.egit.github.core.service.DataService.createCommit(DataService.java:397)
at com.github.maven.plugins.site.SiteMojo.execute(SiteMojo.java:454)
... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Though it is very basic question , but can some please help me how can i try the Snapshot version , I am facing the same problem Expected data to be of type "object"; value was: nil. (422)
@kapilag snapshot version won't help. The bug is still in master.
can someone please merge one of the provided pull requests and fix the broken plugin? who is a maintainer of it?
Merge is done, see 87c5b2eda1d5e4090bb4a29a9b0f07543f0b42be
Now, a release would be just fine ;)
NO I tested the latest From source and still " "string"; value was: nil." is there
@yegor #72 was pulled into master; though there is 1 report of this not fixing the problem
@kapilag check out the sourcecode and run mvn install
your local repo will provide the snapshot
@mprins I do have snapshot build but it is not helping on issue as now it throw error as @brianoliver posted "Expected data to be of type "string"; value was: nil. (422)"
tip
checkouted, builed and running just fine here
@theanuradha : maybe your local GIT conf is missing / incorrect ?
@bguerin Maven Build was config with Github AUTH key so it dose not matter my local GIT conf
the following patch worked for me ... my email was being retrieved as null, even though it was set both globally and in the local project.
Index: github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java (revision 4c80551d451a817f8f2c7c623c074e8782f5a6fb) +++ github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java (revision ) @@ -432,8 +432,8 @@ User user = userService.getUser();
CommitUser author = new CommitUser();
author.setEmail(userService.getEmails().get(0));
author.setDate(new GregorianCalendar().getTime());
commit.setAuthor(author);
On Mon, Sep 8, 2014 at 7:37 PM, Anuradha G notifications@github.com wrote:
@bguerin https://github.com/bguerin Maven Build was config with Github AUTH key so it dose not matter my local GIT conf
— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/69#issuecomment-54916479.
that patch is for 0.10-SNAPSHOT
On Mon, Sep 8, 2014 at 10:17 PM, B. Todd Burruss btoddb@gmail.com wrote:
the following patch worked for me ... my email was being retrieved as null, even though it was set both globally and in the local project.
Index: github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java (revision 4c80551d451a817f8f2c7c623c074e8782f5a6fb) +++ github-site-plugin/src/main/java/com/github/maven/plugins/site/SiteMojo.java (revision ) @@ -432,8 +432,8 @@ User user = userService.getUser();
CommitUser author = new CommitUser();
- author.setName(user.getName());
- author.setEmail(user.getEmail());
- author.setName(userService.getUser().getName());
author.setEmail(userService.getEmails().get(0)); author.setDate(new GregorianCalendar().getTime()); commit.setAuthor(author);
On Mon, Sep 8, 2014 at 7:37 PM, Anuradha G notifications@github.com wrote:
@bguerin https://github.com/bguerin Maven Build was config with Github AUTH key so it dose not matter my local GIT conf
— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/69#issuecomment-54916479 .
it is working for me as well 0.10-SNAPSHOT
@btoddb is right, my email was null also before his patch
@theanuradha : you are mixing things ...
My Maven project is also using an OAUTH
key, but this only deals with authentication with GitHub servers (ie when doing a push
).
Before doing that push, the plugin will do a commit
and this involves your local git configuration to retrieve who you are (name and mail) to set the autor of this commit.
Exactly the same thing with git commands by IDE / hand : commit
reads your local config (name/email), push
will use your credentials (name/password or SSH key or OAUTH key) to authenticate yourself on GitHub servers.
@bguerin well before it did not need local git config it use OAUTH key associate account information.
Thanks to the patch from @btoddb, it now works! Brilliant work tracking this down.
can we get a fixed version released to Maven Central please?
i should say that i believe the real fix for this should probably be in EGit, but that would probably take longer. my guess, what a client really wants would be the email/name from the local repository, and if that's not set then get it from the global settings.
On Tue, Sep 9, 2014 at 7:42 AM, Yegor Bugayenko notifications@github.com wrote:
can we get a fixed version released to Maven Central please?
— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/69#issuecomment-54979407.
I think btoddb is absolutely correct, his patch didn't work for me, but I checked out the plugin and set hard coded the Username and Email values!!
CommitUser author = new CommitUser();
author.setName("gtsntzs");
author.setEmail("myEmail");
I know it is ugly.... but works
I Confirm that 0.10-SNAPSHOT works. At least for me.
The Repo owner should make a release ASAP as it fixes the problem for some users already. Im not saying that the reported problems of others is less important but for those were 0.10-SNAPSHOT works can work again. For those with problems we can keep digging for the solution and bring it in 0.11
There is no need to wait here. bring it out!!!
Can someone tell me where I can get the SNAPSHOT from Maven is not finding it?
you must download and build it
On Sat, Sep 13, 2014 at 11:30 AM, StrateboLouis notifications@github.com wrote:
Can someone tell me where I can get the SNAPSHOT from Maven is not finding it?
— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/69#issuecomment-55502444.
Thanks I was afraid of that
@StrateboLouis it's really not that hard... definitely not something to be afraid of
git clone https://github.com/github/maven-plugins.git maven-plugins
cd maven plugins
mvn install
I know,
Just a bit bummed that it took me 2 hours to run into the conversation explaining why my development setup was broken.
Thanks for the support.
Everything worked great 5 days ago, but today I started getting this error. Is there anything on my end that I can do?