luigi
luigi copied to clipboard
Question about possibility of debug logging and a problem I'm having (React)
Hi, This is both a question and a problem I am having when my application is built as opposed to when it is being run using the start script.
My question is if there is a way to set up debug logging with Luigi so that I can see where in an application certain things happen? This is related to the issue.
The problem is that when I use the build script followed by deploying using serve, the home page does not load, as instead of loading the requested page (which is set up in the luigi-config.js file) it recursively loads the entire app without the file which in the example would be called sampleapp.html (I have renamed this file and changed the references to it so that it is called renderWindow.html). This problem does not come up when I run the app using the start script.
Hello ReflectionGolden,
I'm not quite sure if I understand your issue.
You have a react app (probably created from our instructions ?) and renamed the sampleapp with all the references.
It does not load when you run npm run build
and serve -s build
but it runs with npm run start
?
Is it correct?
And for debugging you need to run the start script?
Currently we have a bug (which will be fixed soon) in our react script https://github.com/SAP/luigi/issues/2640
Maybe your issue is related to this one? Otherwise I need more information.
Regards, Johannes
Hi, I don't think it is related to the bug, as I found a way around that.
I have a react app which was created using the example application from the documentation as a template. When I run it with npm start
or npm run start
, it works just fine. But when I run it by using npm run build
and then serve -s build
with some options set to allow for using SSL, instead of the homepage it tries to keep loading the whole app within the place it would load the homepage.
I have also created a React app with the instructions, but the script is altered to install the correct version of react-router-dom. I have then tested the above with this completely new and un-altered app, and it does the same thing, so it seems to be an issue with the custom build process included with the application setup.
While detailing the issue I have been having, I was also asking if there was a way to set up debug logging in the build to see if I could find where it is trying to load the homepage so I could try to find a solution myself.
Hi @ReflectionGolden, since our React script was adjusted and working properly now, I would close this ticket. If you need any further assistance, please do not hesitate to respond to this. Thank you.
Hi @stanleychh, this is not caused by the script for setting up a react project for Luigi.
Here is how you can reproduce the problem:
- use the React Setup Script to create a new, clean luigi project.
- open the project in an IDE, and in the terminal run the command "run npm build" from the project's root directory.
- now run "serve -s build" to deploy the built project, then go to the address that it will automatically copy to your clipboard.
expected result: exactly the same as what it shows immediately after the use of the setup script.
actual result: it recursively loads the app inside of itself with a flash of the error "Could not find the requested route sampleapp."
Hi @ReflectionGolden, thanks for your information and I can reproduce this issue now. We will have a look on this bug.
Hey @ReflectionGolden ,
sorry for the late answer. If you run the build
folder just with serve build the app works as expected.
-s, --single Rewrite all not-found requests to `index.html`
The react application runs on http://localhost:3000/sampleapp#/home
. Luigi resolve this to http://localhost:3000/home
.
It seems that npm serve -s build
tries to resolve http://localhost:3000/sampleapp#/home
which can not be found and redirect due to -s to /index.html which is http://localhost:3000/home
which is under the hood http://localhost:3000/sampleapp#/home
which cannot be found and so on.
I close this issue. If you have further questions feel free to reopen it. Best regards