R
Railway•6mo ago
BillK0001

GitHub access problems during build

Hi - I'm having GitHub access issues when trying to build a springboot app in Railway. The build is trying to access a private Maven repository I have hosted on GitHub but gets a "status code: 401, reason phrase: Unauthorized" when it tries to resolve dependencies for my Maven repository. The build works fine in my own development environment so I know the repository is built correctly and is accessible. My Railway project depends on a few other GitHub repositories and has no problems reading them and triggering builds on update. I have the Railway GitHub integration set for full access to my GitHub repos. Not sure what I'm doing wrong. I also followed this: https://blog.railway.app/p/github-actions without success. Any help would be greatly appreciated! projectId: 9a9b1f11-b9ff-43a7-b9f3-3c764927c3f8
Railway Blog
Using Github Actions with Railway
Github Actions come with a pretty neat set of features to automate your workflows. In this post, we talk about using Github Actions to automate your deployments on Railway.
13 Replies
Percy
Percy•6mo ago
Project ID: 9a9b1f11-b9ff-43a7-b9f3-3c764927c3f8
Brody
Brody•6mo ago
just to be clear, do you get these issues in the build logs on railway when trying to pull a private package from github?
BillK0001
BillK0001•6mo ago
yes, the error is captured in the build logs on railway. Failed to execute goal on project sattrackboot: Could not resolve dependencies for project com.wjk:sattrackboot🫙0.0.1-SNAPSHOT: Failed to collect dependencies at XXXXX:fd-core🫙0.0.1-SNAPSHOT: Failed to read artifact descriptor for XXXXX:fd-core🫙0.0.1-SNAPSHOT: The following artifacts could not be resolved: XXXXX:fd-core:pom:0.0.1-SNAPSHOT (absent): Could not transfer artifact XXXXX:fd-core:pom:0.0.1-SNAPSHOT from/to github (https://maven.pkg.github.com/XXXXXX: status code: 401, reason phrase: Unauthorized (401) That's the error where I substituted XXXX for my github account id (for privacy 🙂 )
Brody
Brody•6mo ago
gotcha, railway does not support pulling dependencies/packages from private github repos yet
BillK0001
BillK0001•6mo ago
Darn! Thanks for the insight. Was spinning my wheels for a while on this. Now have to come up with another solution to get my builds to work. Would rather not make the maven package public at th emoment.
Brody
Brody•6mo ago
I honestly can't think of a good way to do this, the best idea I can think of would be building an image for your app on github and deploying that, but that also has to be public so I don't think that solves much
BillK0001
BillK0001•6mo ago
.... still kind of a noob at this but was thinking of just packaging the jar file in the repo that depends on it.
Brody
Brody•6mo ago
that might be a good idea, but I don't know tbh, I'm not a java dev
BillK0001
BillK0001•6mo ago
I was able to get this working by building a custom nixpacks build. In the "setup" phase, I install the jar file locally and then do a normal build. The build/deploy process creates the service and I'm able to use it but my dashboard shows the service in a perpetual "building" state. Not sure why it's doing that. Here's a copy of my build file: providers = ['...'] [phases.setup] cmds = [ "echo custom setup", "echo copying local jar ...", "mvn install:install-file -Dfile=./PrivateJars/fd-core-0.0.1-SNAPSHOT.jar -DpomFile=./PrivateJars/pom.xml", "...", "echo custom setup complete" ] [phases.build] dependsOn = ["setup"] restartPolicyMaxRetries = 1 cmds = [ "echo custom build", "...", "java -Dserver.port=$PORT -Dspring.profiles.active=production $JAVA_OPTS -jar target/*jar", "echo custom build complete" ]
Brody
Brody•6mo ago
you are running your server in the build
BillK0001
BillK0001•6mo ago
thanks! As soon as I figure out how to "buy coffee" or "buy railway" I'll send something your way.
Brody
Brody•6mo ago
haha dont feel any need to, but thank you