Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load package details #149

Closed
PhilippSoehnlein opened this issue Jun 30, 2015 · 13 comments
Closed

Failed to load package details #149

PhilippSoehnlein opened this issue Jun 30, 2015 · 13 comments

Comments

@PhilippSoehnlein
Copy link
Contributor

We just updated to private-bower 1.1, but unfortunately the package details (#109) aren't shown (error message Failed to load package details! appears in web ui).

Clicking a package name in the web ui triggers a GET request to an URL like this: http://private-bower.our-company.intra/packages/angular/details which returns a 404.

Our private-bower instance caches third party git packages, so the config looks like this:

{
    "port": 80,
    "registryFile": "./bowerRepository.json",
    "timeout": 144000,
    "public": {
        "disabled": false,
        "registry": "http://bower.herokuapp.com/packages/",
        "registryFile": "./bowerRepositoryPublic.json",
        "whitelist": [],
        "blacklist": []
    },
    "authentication": {
        "enabled": false,
        "key": "password"
    },
    "repositoryCache": {
        "cachePrivate": false,
        "git": {
            "enabled": true,
            "cacheDirectory": "./gitRepoCache",
            "host": "private-bower.our-company.intra",
            "port": 6789,
            "publicAccessURL" : null,
            "refreshTimeout": 10
        },
        "svn": {
            "enabled": false,
            "cacheDirectory": "./svnRepoCache",
            "host": "localhost",
            "port": 7891,
            "publicAccessURL" : null,
            "refreshTimeout": 10
        }
    },
    "proxySettings" : {
        "enabled": false,
        "host": "proxy",
        "username": "name",
        "password" : "pass",
        "port": 8080,
        "tunnel": false
    },
    "log4js" : {
        "enabled": false,
        "configPath" : "log4js.conf.json"
    }
}

Calling http://our-host.company.intra/packages/angular returns the following JSON document (not sure if this is helpful, but maybe it is):

{
    "name": "angular",
    "url": "git://private-bower.our-company.intra:6789/angular",
    "hits": 17
}
@mmaday
Copy link

mmaday commented Jun 30, 2015

I'm having the same problem with "Failed to load package details!" showing up on the Web UI over here.

Looking at the logs / console output, I see a lot of these:

[2015-06-30 16:41:33.574] [INFO] console - [bower] 30/6/15 16:41:33 Error during "git clone https://git.corp.***.net/git/eng/labor-services.git /usr/lib/node_modules/private-bower/lib/temp/packageDetails/6js4hrijzx8byb9 --depth=1" in "undefined"

@Hacklone
Copy link
Owner

Does the private-bower server have access to the https://git.corp.***.net/git/eng/labor-services.git repo? Because it will try to clone it temporarly :)

@brunowego
Copy link

+1

@Hacklone
Copy link
Owner

The private-bower server needs access (ssh, https) to the git repo.
Is it configured?

@PhilippSoehnlein
Copy link
Contributor Author

I think there are two problems here:

  1. Not getting package details for private packages hosted on an internal git server.
  2. Not getting package details for public packages which are cached by private-bower itself.

In my case both problems are apparent and I haven't done anything special to allow access from the private-bower server to our internal git server, so I'm not surprised that doesn't work (what should I do to make that work?). But what surprises me is that the package details of cached public packages aren't available for private-bower since it's hosting them itself.

@PhilippSoehnlein
Copy link
Contributor Author

Supplemental: I also can reproduce the log message @mmaday reports. For our own internal git server there's indeed an access problem which I will investigate further. But for public cached packages it also says

Error during "git clone git://private-bower.our-company.intra:6789/angular /usr/lib/node_modules/private-bower/lib/temp/packageDetails/slfdjlk1bye3ik9 --depth=1" in "undefined"

When I do a manual git clone git://private-bower.our-company.intra:6789/angular on the shell of our server, cloning works.

@mmaday
Copy link

mmaday commented Jul 16, 2015

@Hacklone is correct in my case. The user running private-bower didn't properly have access to https://git.corp.***.net/git/eng/labor-services.git mentioned in this log:

 [2015-06-30 16:41:33.574] [INFO] console - [bower] 30/6/15 16:41:33 Error during 
"git clone https://git.corp.***.net/git/eng/labor-services.git /usr/lib/node_modules/private-bower/lib/temp/packageDetails/6js4hrijzx8byb9 --depth=1" in "undefined" 

@Hacklone
Copy link
Owner

Hey,

I cannot really reproduce your error with the mirrored repositories. If I have the correct permissions to clone the git repository, where ever it is, it's working for me.
I'll put a line in the error message explaining that the server needs permission to the repository.

Hacklone added a commit that referenced this issue Jul 26, 2015
* 1.1.1:
  registering a public package for the first time, hit count fixed #157
  Added tip for API usage in README.md #154
  Added process.env.PORT and process.env.IP support #141
  Added help text to package detail errors #149
@Hacklone
Copy link
Owner

Hacklone commented Aug 1, 2015

I cannot see why it should fail other than the server doesn't have cloning rights to the repo.

@PhilippSoehnlein
Copy link
Contributor Author

For me, it still doesn't work though I can clone a git repository from our internal git server from the command line of our private-bower server (as root, because private-bower runs as root).
For debugging purposes: Could you put the output of the git clone command into the logfile if there was an error?

@PhilippSoehnlein
Copy link
Contributor Author

Sorry, for posting again, I'm getting nearer the problem: The user our private-bower server runs isn't root and therefore my git/ssh-config is wrong. I currently think private-bower is correct, but our git/ssh-config is wrong. This can probably be closed, but I may come back to you, when it's resolved.

@PhilippSoehnlein
Copy link
Contributor Author

Ok, we finally sorted this thing out and I write about the problems here in case someone else will run into this in the future.
To get repository contents from our git-server some valid credentials are needed (which provide access to the repository in question). This auth mechanism uses SSH keys. Since our private-bower instance runs on Ubuntu, we used the manual in the wiki which starts the private-bower service under the www-data user. By default this user doesn't have an SSH-key in Ubuntu (and no home directory either), so the solution was to give this user a home directory and create an SSH key and allow this SSH key some access to our git server.

Another problem emerged then: private-bower checks out the repositories to a temp folder within the private-bower folder (on Ubuntu it's /usr/lib/node_modules/private-bower/lib/temp/), but this folder doesn't exist by default and in our installation (don't know if this is Ubuntu standard) all files in /usr/lib/node_modules/private-bower/lib/ belonged to user nobody and the group users with rights 755.
To make the cloning work we had to execute the following commands:

  • sudo mkdir /usr/lib/node_modules/private-bower/lib/temp/
  • sudo chmod 755 /usr/lib/node_modules/private-bower/lib/temp/
  • sudo chown www-data:www-data /usr/lib/node_modules/private-bower/lib/temp/

It would probably be a good idea to switch to some node module which provides system independent access to a temp folder, to make sure this stuff works independently from the system and user environment private-bower runs on.

@gyozob
Copy link

gyozob commented Dec 13, 2016

Hello, here I have a similar issue, can somebody tell me how to give private-bower server access to the git repo? I set up private-bower on my local machine (windows), also added ssh key to git repo so I was able to clone/push to that repo... please help cc @Hacklone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants