R
Railway

✋|help

Relative path issue

FFiri8/21/2023
I am trying to read some Json files and parse them with one of my services. Locally it works fine.

I've tried 3 different methods of determining the path and all of them have the same path issue

So here is my deployment log message
Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Gladiators_Armor.json'.

here is my path creation that works locally in dev mode

string jsonFilePath = Path.Combine("wwwroot", "json", "homecoming", "boost_sets", $"{enhancementName}.json");

string jsonFilePath = "wwwroot/json/homecoming/boost_sets/" + enhancementName + ".json";


string webRootPath = _env.WebRootPath; string jsonFilePath = Path.Combine(webRootPath, "json", "homecoming", "boost_sets", $"{enhancementName}.json");


All three above work locally just fine and all 3 give me the same error when deployed
Solution:
the good old .toLowerCase()
Jump to solution
FFiri8/21/2023
Project Id:
740eb4a0-07aa-4fed-aac4-d9d5028a12b8
Bbrody1928/21/2023
can we be sure this file or folder its in isnt being gitignored?
FFiri8/21/2023
One moment, let me check
It is all there in my git repo
Bbrody1928/21/2023
okay next question, how big are these json files
FFiri8/21/2023
<100kb each
Bbrody1928/21/2023
should wwwroot be www/root ?
FFiri8/21/2023
No, /wwwroot is correct
It doesn't seem to be finding the project dir maybe?
It is {project}/wwwroot/...
Bbrody1928/21/2023
okay, can you share your repo so i can have a look at the folder structure?
FFiri8/21/2023
Yes, sent via dm
Bbrody1928/21/2023
#🛂|readme #5
Bbrody1928/21/2023
this has no capital letters
Bbrody1928/21/2023
this error does
FFiri8/21/2023
Okay, I will see if that will fix it
Solution
Bbrody1928/21/2023
the good old .toLowerCase()
FFiri8/21/2023
@Brody much appreciated, that fixed it
Bbrody1928/21/2023
no problem!

Looking for more? Join the community!

Recommended Posts
Can't run Railway CLI down command with project tokenhey , it is possible to run the railway down command with railway project token without logging in. Ruby on Rails Deployment with database and redisi had a few questions about linking my database and redis server within railway app ... I tried but Lost all my 20$ credits out of no whereSo i just got an email saying my projects needs 3$ in credits, but suddenly when i check? my whole 2any reason why my usage suddenly jumps to 4GB when there are no tasks running?The app had no requests for for the entire day but the usage jumped, any reason why this could happei want to dowload my post gre db locallyhow can i dowload my post-gre db locallyCloudflare custom domain not workingI just upgraded the api for Cloudflare, but the custom domain is no longer workingError: Unsupported Gradle version: 8============== Using Nixpacks ============== context: 78ee202a04734b630f61d71bea3f81cd  NixpacksOSError: libheif.so.1: cannot open shared object file: No such file or directoryHello, I have tried everything i can to get my django project deployed, the build completes, but depFlask app not workinghey there am very new to railway, i would love to get some help, I am not familiar with hosting a weAverage Cost of Ghost CMS Blog?Hi so I've recently moved over to Railway.app, after hearing great things about it and getting boggewebhook outdated docs and issuesHello First of, https://docs.railway.app/diagnose/webhooks this documentation seems outdated. I'm Configure GitHub PATHow do I configure my GitHub PAT (Personal Access token) while deploying my nestJS app on railway?How can I SSH into my CLI application?Hello, I have an CLI python app deployed but I need to connect to the service. I couldnt find how. IPostgres pricing questionsI'm starting to index a few data to my railway postgres. I need to clarify a few questions: 1. WhaDashboard: View cost by service is brokenI think postgres should be a new row?Memory not released even after postgres table droppedHello. Project ID: 6dee0732-68aa-4ae0-a472-7d02880e238a I created a table on 19th August and then Can only view 100 lines of logsI can only see the last 100 lines fo the logs in log viewer I have opted in to "priority boarding"Unexpected crash - Rust crashes after building with libgssapi-krb5 referenceHey, first time posting an error - my Railway deployment is crashing with the following error: erroDocker Service CRON Restart?Hi guys, i have a single docker service running. I'd like to restart this service periodically via tCan't set a private project to publicWhenever I try to set a private project to public, I get the error "All services in a public project