I’m having a problem with Jenkins, I have a job that runs API Rest tests, the test makes a query in the SQL database to get an id, but Jenkins stops in this part, it doesn’t show any error but it doesn’t run.
I’m running the local Jenkins.
When I run the same test on the same machine in VS Code, the test runs normally.
probably. But you need to figure out what that is. Probably an ENV variable or something in a config file. Maybe even a different version of node on your build agent. You need to figure out whats different. Probably by tracing the code. Jenkins doesn’t do anything to your code, just runs the commands you tell it to.
Without access to your build agent (which I don’t want) and without access to your code. There’s nothing we as external people can do.
My recommendation is to go look at what that function that is returning the variable does, and see what its doing. Maybe its talking to the wrong port, or the server is running differently. Or the server never started up.
Or in your pipeline, run printenv in linux, set in windows, and see what environmental variables are set, and compare them with your local environment. Maybe node -v as well to see.
Most simple guess: The sql access is not granted for the jenkins user.
Always remember: a job in jenkins typically runs as another user, even if you run jenkins on the same machine and you always need to configure credentials for external systems. How to that in your case is hard to tell as we do not know yout setup/code.