6 months ago
Hello
I am working on a frontend implementation and need to set up a custom .npmrc file which is ignored by git, so it's not in the repository by default.
How would I best go about doing this so I can deploy access to the application tools I need access to ?
0 Replies
6 months ago
Try setting the engines.node
in your package.json
6 months ago
you can also provide a NIXPACKS_NODE_VERSION
env var, but you can only set it to major versions: 14, 16, 18, or 20
6 months ago
you can read about it here: https://nixpacks.com/docs/providers/node#setup
6 months ago
@Zerkia pinging for visibility
Ended up exposing the file instead and transferring sensitive data as an .env and that seems to have worked.
However, when trying to make an optimized production build, it seems after a while it just gives up and crashes. the error code doesn't really tell me much either that I know of either. Could you perhaps take a look if possible ?
6 months ago
If u send ur build logs here, sure
This is the error area, I don't know how to copy the full build log, couldn't see a copy button anywhere
6 months ago
Cntrl K -> Download Logs
6 months ago
Just to make sure, you aren't commiting your node_modules to the repo, right?
Nono, it's a company app I need to upload a copy of to my exam. Looking up some StackOverflow posts, it may be the CI seeing the eslint and prettier errors as actual errors
6 months ago
yeah, that's a possibility
Completely forgot to report back sorry.
Missing some authentication with sentry which my company makes use of. My supervisor asked if skipping the build portion is possible and going directly to the "npm run start" portion of the deployment ?
Completely forgot to report back sorry.
Missing some authentication with sentry which my company makes use of. My supervisor asked if skipping the build portion is possible and going directly to the "npm run start" portion of the deployment ?
Little update on that: Tried setting the custom build command to "npm run start", but that just seems to have it stuck in "building…" for forever
Albeit the site does not seems accessible due to it not getting to the deploy stage
6 months ago
you cannot start your app during build
6 months ago
build is for building
Yeah I figured, just wanted to try. Is there no way to omit the build stage whatsoever and just have it directly go to "npm run start" or similar ?
6 months ago
you mean omit running npm run build
6 months ago
I obviously don't know much about your project, but are you sure you can skip it? what does the build script actually run?
6 months ago
you definitely need to run build for react scripts
6 months ago
so you can just replace the build command in the service settings with that
6 months ago
you will also need to copy the Caddyfile and nixpacks.toml from this repo into yours, otherwise you'll be asking Railway to run a development mode server for your app
6 months ago
and sentry probably has some docs about a ci/cd environment
6 months ago
maybe u just miss some extra config?
My supervisor suggested removing the sentry part of the build command and running it build + run like it should be
6 months ago
please do this now
Haven't done that yet, will do so now if still required, just wanted to mention:
It seems to run, deploy and such but then crashes very shortly after, stating:
Starting the development server...
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
Just wanted to mention it before adding the files, in case I need to do something else as well on the railway server
6 months ago
Are you on railway trial?
6 months ago
or do you have the hobby plan?
6 months ago
this is still needed
It doesn't seem to crash now, after adding the files, but I don't seem to be able to access the page, stating a 502 bad gateway. the railway url is set to run via port 3000
6 months ago
your target port is wrong
6 months ago
click the edit icon and choose the correct port
Page seems to be running now, just need to add the new url to the whitelist for my backend, so keeping this open for another moment, just in case something Railway-relevant pops up. If not, I'll let you guys know, thanks 🙂
Does not seem to be talking with the backend properly despite the whitelist. I remember I had a similar issue when trying to deploy the code locally for production, compared to development. Is there any way to have the code running in development on the host at all? Not sure if it's smart or anything of course, but considering I only need to showcase some crud actions that runs through redis and postgresql tomorrow for my exam, would it be possible ?
6 months ago
nope, please do not run a development server, on any cloud server
6 months ago
Does not seem to be talking with the backend properly
please explain more, this amount of information makes it impossible for us to provide support
Of course, I'm trying to troubleshoot it myself at the moment, as it seems to potentially be internal, but I'm trying to ensure that, that is the case first
6 months ago
is there a link we can goto to see the error?
the error happens on the platform itself when trying to log in to it. my api does not seem to be properly reached, and I'm trying to figure out why that is. It's kinda hard to explain as I'm not sure what causes it. My guess is maybe some development mode vs production mode stuff but I'm (very slowly) trying to get contact with my supervisor to get some answers, as this is not something I've developed, and it's the last thing I need for a hosted application.
I have already updated the various areas that needed updates in regards to postgres, redis, front and backend urls', as well as whitelisting them, so I don't think it's something as simple as a bad url when running the flask api request
6 months ago
have you tried looking at your networking tab in the dev tools for your browser?
I have, I see no payload, but the request goes through as a 200. the console showcases a CORS with the api call mentioned
6 months ago
does it go to the correct url though
6 months ago
are you using a REACT_
env var to set the api url?
6 months ago
why is that called an API key instead of a url?
6 months ago
an API key is a completely different thing
Don't ask me, I didn't make it. I'm looking at where the apitokens comes from and it's lead me to my company's JWTcontext file, but I can't really seem to see the wrong url being hardcoded or anything anywhere. But my supervisor told me to look there.
None of the url stuff is my code though so it's kinda confusing for me to look through honestly.
In general also kinda hard to help you help me when I don't know how their server is set up really
6 months ago
let me know when you know
Honestly I don't know if I ever will. I can try calling you and screen sharing to try to explain, but honestly their app is huge so it's kinda hard for me to explain since I didn't make this from scratch, but merely added some functionality to it.
6 months ago
I'm sorry but we would not be able to offer that level of support to your class of plan
6 months ago
update code to call the backend with a url defined in a variable
set that variable in your service variables
I managed to get it working thanks to a friend who had some expertise in the codebase.
Turned out to be a multitude of issues:
Build folder was not gitignored so it defaulted to an old build
some env variables were slightly outdated
whitelist had trailing slashes when they shouldn't have had
Passed my exam though, so thank you all for your help, I greatly appreciate it 🙂
I'm marking this as solved, feel free to close it whenever
6 months ago
awesome!
6 months ago
!s
Status changed to Solved brody • 6 months ago