HTML/JS directory disappears on production server - angularjs

So, I have a full-stack web application generated with JHipster, I have recently needed to change the name of one of the entities in the webapp area and the template/js files because it was clashing (had the term api in it)
Now it all works just fine in local, but when uploading the application to jenkins for production it just won't want to find the new files
I have tried:
Hard reload / Ctrl + Shift + Del / and opening in a different browser
Erasing the target folder.
Wiping the whole workspace from jenkins.
I created a new item in jenkins.
Changing the href manually in the developer tools
All unsuccesful and result in the same error message
The most annoying thing is that it works like a charm when deploying in local, with both dev and prod profiles.
This is the error message I get on the console, obviously it never reaches the back-end so remote debugging was useless for this:
GET [long url here]/app/entities/trade-drug-capi/trade-drug-capis.html?cacheBuster=1488389348167 404 (Not Found)

Related

React app not appearing on live server (works locally) - No visible errors, suspect backend issue

Could use the wisdom of the crowd on this one. I just updated this React app, but like you can see on the page nothing appears. Here are the facts:
Link to the app | Code repo (though I don't think the code is the issue)
The dev build works fine on localhost (npm start)
The production build works fine on a local server (npm run build)
If you look in the developer tools at the above link, you can see all the files are loading 200 in the browser, no errors in the console or 404s.
The base href is set to ./, which is correct given the app is in a subdirectory (and again, there are no console errors)
There is no cache set in the headers, and the static files themselves use aggressive caching techniques. I have deleted the old files from the directory on the server and uploaded the production build, plus I checked the cache and .conf file on the nginx server for anything out of the ordinary.
This app was working last week at this URL (before I recently merged two pull requests), but the code changes were not to any of the component routing, and again, the app works fine on localhost and a local server.
So I feel like I'm missing something obvious and could use some other suggestions. I think the issue is on the backend, but I've hit a brick wall and could use a second set of eyes on it. Thanks for any help you can provide.
There is no route defined in your app that matches /dev/impact. If I manually push / to the history object your app renders the HowRichAmIStandalone component correctly on your production server.
I guess in development it works because your local development server serves the app e.g. at localhost:3000/ and not localhost:3000/dev/impact. You need to set the correct basename on the router in order for it to work:
<Router basename="/dev/impact">
{/* ... */}
</Router>
You can also define the basename in your env and only make it /dev/impact for the production environment if you don't want to have to type localhost:3000/dev/impact in development.
<Router basename={process.env.BASE_URL}">
{/* ... */}
</Router>

when page refresh "404 - File or directory not found."

my react app is working locally but after the deploy, I faced the problem when I press any button there is no problem but if I want to refresh I see that problem "404 - File or directory not found."
I found this solution:
https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#browserhistory
Configure Your Server
"Your server must be ready to handle real URLs. When the app first loads at / it will probably work, but as the user navigates around and then hits refresh at /accounts/23 your web server will get a request to /accounts/23. You will need it to handle that URL and include your JavaScript application in the response."
But I don't know how can I do this
I try something but it doesn't work
TRY
npm run build, this will create build folder inside your project root folder
if you want to deploy to remote server just transfer that build
folder.
npx serve -s build on windows, if you are using mac kindly see if it is still npx.
then try to refresh every path of it
hope this works, happy coding.
Since the server cannot find the static content in the directory (i.e. not found the file /tomcat/accounts/23), it will give you 404 unless you have additional route handling.
In React routing I think you can try with HashRouter
See more details here:
https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/api/HashRouter.md
HashRouter vs BrowserRouter

Spring Devtools triggers restart when changing excluded files

I have a Spring Boot Web Project that uses Joinfaces and Primefaces. The application extends from SpringBootServletInitializer and also generates a war file.
For development I start my Project (in Eclipse) using RunAs -> Spring Boot App. I've added the spring-boot-devtools dependency as described in the Developer Tools Docu. Everything seems to work, except that changes in a xhtml file also triggers the restart.
I've added the spring.devtools.restart.additional-exclude property in my application.yml to exclude also webapp/**. But this seems to have no effect, because a change still triggers the restart.
spring:
devtools:
restart:
additional-exclude: webapp/**
My Project structure looks like:
src
-main
-java
-resources
-webapp
- *.xhtml
But maybe I do not understand how to use the DevTools correct - Starting the application as Spring Boot App might not be the correct usage? Because if I place a file e.g. foo.txt under src/main/resources and update its content the application is also restarted (using the DevTools defaults (which should exclude /resources)).
Using:
Eclipse Oxygen.3a Release (4.7.3a)
Joinfaces 3.2.1 -> Spring Boot 2.0.2.RELEASE
The solution to my main problem might be relatively easy.
I've added the webapp folder as Source Folder in Eclipse. As soon as I've removed the folder from the list of source folders, the reload was no longer triggered when I changed something in the xhtml files.
This answer gave me the idea, that the source folder might be the problem.
My exclude also did not work. What I did as a workaround is slowing the reload down like this:
poll-interval: 6000
quiet-period: 5000

service worker canceling out REST urls

just started working with reactjs recently, month or two..not a pro but can find my way around.. I am using create ract app (quickie ,that ships with service-worker) and my setup is such that I am deploying react app in the root of my java REST application, so all my service rest calls are in relative format, e.g /rest/myservice/123 etc.. and they work just fine..
but recently I started getting strange errors, and rest calls stopped working..
if I execute RET URL from browser .... nothing happens index loads... when I test with postman REST works just fine it also works in safari or if url is localhost... ...so after hours of frustration i discovered that service worker doing its .... caching . my rest calls are getting intercepted and they never make it to server... and there is nowhere that it mentions about how to overcome it, neither in service worker docs nor in create-react-app docs ...nothing is mentioned about this use case...... this is so pathetic...
I figured it out after numerous trail and errors... but it did not stop there..
I went ahead and deleted the service-worker registration entry from index.js also deleted service-worker file and rebuild the app. well service-worker.js file is still there... it showed up in build folder after I rebuild the project..... what is it with create-react-app did they got paid by google to include service-worker? or what is going on? why can not I remove it? and how do I prevent it from canceling my rest url calls?
when I type : https://xxxx.io/x/referal/refCode/3429878 it just loads application...
what else am I missing?
got the answer over #Redit needed to unregister worker...
details #:
https://www.reddit.com/r/reactjs/comments/8hovvb/removal_of_serviceworker_from_reactjs_app/

NetworkError: 404 Not Found on firefox

We have a gwt app deployed on gae for java. The app runs fine in google chrome but fails with below exception on ie and firefox
NetworkError: 404 Not Found - http://www.sakshum.org/adminmodule/67883654A8944A4C561CF25763FB1D79.cache.html
based on Setup a GWT Project correctly with SVN and Eclipse we have excluded the files in adminmodule directory to upload to app engine.
Please advise what is reason for it to fail and how to make it working.
The ignored patterns are:
.svn
*.bak
classes/
thumbs.db
*.class
.gwt*
gwt-unitCache/
deploy/
war/adminmodule/
war/sakshumwebgae/
sakshumweb/war/WEB-INF/deploy/adminmodule/
sakshumweb/war/sakshumwebgae/
.bin
*.orig
You will get 404. HORROR!!!!
Currently only /deploy/ folder can be ignored and not war/gwtmodule.
All the gwt generated scripts are in war/gwtmodule and you need to upload them per compilation into appengine.
These are generated every build in compilation phase and hence are not checked into svn.
They need to be in deployment folder for APP Engine.
I suggest you go through the GWT teams excellent document for App Engine with GWT https://developers.google.com/web-toolkit/doc/latest/tutorial/appengine
Edit -
<modulename>.nocache.js loads <longnumeric>.cache.html based on browser * language permutation. GWT compiles your java code to create the <modulename>.nocache.js and the relevant cache.html files. cache and nocache indicates whether browser is supposed to cache or not cache the file.
You will have the .nocache.js script reference in your html file for the gwtapp.
It's normal for the GWT compiler to build different javascript files for each permutation. A permutation is for a specific user-agent (browser, eg ie9 gecko (ff), webkit (chrome/safari)) and language (English, French). So you've correctly uploaded all the output files for the chrome browser, presumably in English. It would seem, as you say, that you're filtering out other files from uploading, and that some of those files are requested when using a different permutation for Firefox in English. You should try not to filter those files.

Resources