-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript Required error #45
Comments
Hi @garyisaac. The Pain Management Summary App is a SMART App. As such, its primary use case is to be launched from an EHR SMART launcher. You cannot browse directly to the app at http://localhost in a browser. You need a SMART Launcher to invoke it, as this injects necessary data into the app via query parameters. Have you tried launching the app from the SMART Sandbox? There are instructions for this in the README here. Note, however, that the App Launch URL you enter in step 3 will be different since you're deploying at the root. You probably need to enter something like If that's working but you're having trouble finding patients with data that satisfies the app, then try uploading test patients as documented here. (Note: you may see a few errors, but this is OK). Then launch the app again, but this time pick Brenda Jackson as the patient. BTW, I tested this all by editing the |
Thanks Chris! I did not realize that I could not hit it directly at the URL. I will test it using a sandbox. I appreciate the help.
From: Chris Moesel ***@***.***>
Sent: Wednesday, November 1, 2023 2:15 PM
To: AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY ***@***.***>
Cc: Gary Isaac ***@***.***>; Mention ***@***.***>
Subject: Re: [AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY] Javascript Required error (Issue #45)
Hi @garyisaac<https://github.com/garyisaac>. The Pain Management Summary App is a SMART App. As such, its primary use case is to be launched from an EHR SMART launcher. You cannot browse directly to the app at http://localhost in a browser. You need a SMART Launcher to invoke it, as this injects necessary data into the app via query parameters.
Have you tried launching the app from the SMART Sandbox? There are instructions for this in the README here<https://github.com/AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY#to-test-the-app-using-the-public-smart-sandbox>. Note, however, that the App Launch URL you enter in step 3 will be different since you're deploying at the root. You probably need to enter something like http://localhost/launch.html (but also account for the port if you server on something other than 80). If it still doesn't work, try it in a private browsing window; sometimes the browser cache can cause a problem.
If that's working but you're having trouble finding patients with data that satisfies the app, then try uploading test patients as documented here<https://github.com/AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY#to-upload-test-patients-to-the-public-smart-sandbox>. (Note: you may see a few errors, but this is OK). Then launch the app again, but this time pick Brenda Jackson as the patient.
BTW, I tested this all by editing the homepage in package.json as you described, then running npm run build, then serving it via an Apache httpd Docker container: docker run -dit --name my-apache-app -p 8000:80 -v "$PWD/build":/usr/local/apache2/htdocs/ httpd:2.4. This served it on port 8000, so when I configured the SMART launcher, I used http://localhost:8000/launch.html as my App Launch URL. It all seemed to work fine when I ran it this way.
—
Reply to this email directly, view it on GitHub<#45 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAYMLVP5UW7FHH6MENAGXQLYCKGRZAVCNFSM6AAAAAA6XZF2D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBZGQZDSNRQHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi @Gary-Isaac. Thank you for the additional details. I noticed that in your "homepage": "http://localhost/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY" In your initial message, you said "I am using http://localhost in package.json". I think I misunderstood you, because I thought you meant that you were using That's fine (and actually closer to our default deployment approach). It just means that some of what I recommended above is not quite right. So... as long as you keep your
Hopefully that helps. I apologize for the earlier miscommunication! |
Thanks for your help. I did seen an error based on your guidance. I had the app in the build folder in Apache (/var/www/html/build). I changed it to /var/www/html/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY modified my Apache config and restarted the server. I am still get the same error. I tried in a private browser and a different browser.
It is interesting that the Launch Sample App only works in a private browser. 000-default.conf <VirtualHost *:80>
apache2.conf <Directory /var/www/> <Directory /var/www/html> /var/www/html/build/.htaccess Options -MultiViews Config from https://medium.com/@manojprasad452/how-to-deploy-a-react-app-on-apache-web-server-73e468353118 Thanks again. |
Hi Gary, I'm sorry you're running into trouble. Others haven't reported these types of issue before, so I'm not sure what's going on. I don't have an apache server running anywhere, so I was using the httpd Docker image and its default configuration. I was able to extract the default config from the docker image. Here it is in case it is helpful (renamed with a Uploading test patients is helpful once you get the app working correctly -- but I don't think you're even getting that far, so it shouldn't matter. I'll try again and walk through the steps in case it is helpful (even though you are doing it a bit different).
(NOTE: Your compiled JS may have different numbers at the end. That's OK.)
If you're not familiar w/ Docker, the
Although this didn't load the full summary, this is the expected output for this patient. If you can get this far, then your app is probably working. At that point you can upload the test patients (as described in an earlier comment) and use Brenda Jackson. Note -- I did not do any of this in a private window. The reason I sometimes recommend a private window is because if you've tried the app a few times, it's possible that your browser is caching an old version of the app which might not work. You can also get around that by clearing your cache (at least for the domain you're hosting your app on and maybe for the smarthealthit.org domain too). I'm hoping that maybe this is helpful. If you have docker, you might try following these exact steps yourself just to see it working. Otherwise you need to adapt step 5 to your environment. |
Thank you Chris for the comprehensive instructions. Hmm... I am using Node.js version v12.22.9 on Ubuntu 22.04 server. That sounds like an old version. My build output is the same as yours. ubuntu@ip-172-31-37-79:~/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY$ npm run build
Creating an optimized production build... File sizes after gzip: 514.24 kB build/static/js/main.db8014c9.js The project was built assuming it is hosted at /AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY/. The build folder is ready to be deployed. Find out more about deployment here: Why did you use port 8000 in http://localhost:8000/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY/ when your package.json home does not use 8000 (http://localhost/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY)? I guess more specifically. Do I have to use port 8000 in some way to run the app? I am using port 80. |
I am tried several Apache2 configurations and cannot get it to launch. I am still wondering about the relationship of port 8000. Your Readme file states under step 3 the homepage value should be http://localhost:8000/pain-mgmt-summary when deploying to https://my-server/pain-mgmt-summary/. I guess it is saying that https://my-server and http://localhost:8000 do not have to match.
3. Modify the homepage value in package.json to reflect the path (after the hostname) at which it will be deployed a. For example, if deploying to https://my-server/pain-mgmt-summary/, the homepage value should be "http://localhost:8000/pain-mgmt-summary" (note that the hostname need not match) b. If deploying to the root of the domain, you can leave homepage as "." |
Hi Chris, It seems like Nginx is a good option for deployment. I'll try it. I could also try Heroku or Amplify is Nginx does not work. I guess I should update my Node to minimum version 16. |
Hi @garyisaac / @Gary-Isaac. I would definitely try updating your version of Node first. Node 12 reached end-of-life a year and a half ago. On my system (a Mac), I can't even successfully build this app using Node 12 (it crashes). It's quite possible that Node 12 is the problem here -- so I'd change that before changing anything else. After upgrading, delete As for my use of port 8000, I only did that because I have a different service already using port 80 (and port 8080) on my system. But it should not matter what port you use. You also don't need to put it in the As for alternate servers... if it's still not working after upgrading to Node 16 or 18, then you could try the server script that is built into this project. First run |
Hi Chris, I updated to Node 18, built the app again, ran it on Apache and the same blank screen came up when I launched it using a private browser on the SMART sandbox. Then I installed nginx and ran it the same way. Blank screen again. I have noticed that a bunch of posts say to clone the repository inside the web server folder, build the app, and then configure the server to point to the build directory. Essentially, the repo is copied to the web server root directory then built and the actual public root is pointed to the build folder. Tried that and the same blank screen came up. Everything I have read seems to say a blank screen means the homepage value is incorrect. Are you sure this is correct? "homepage": "http://ec2-18-216-106-104.us-east-2.compute.amazonaws.com/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY", |
Hi @Gary-Isaac. The homepage is used to indicate the relative path where the webapp resides on the server. If you point the public root to the If you plan to serve the build contents at the public root of the server, then:
OR if you plan to serve the build contents at the relative path "/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY", then:
Either approach should work -- you just need to ensure that your "homepage", relative public path on the web server, and launch URL you use in the sandbox are all consistent. |
Hi @Gary-Isaac. Have you been able to get this working? |
Thanks for checking in Chris. No, I did not get it running.
From: Chris Moesel ***@***.***>
Sent: Thursday, November 30, 2023 8:54 AM
To: AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY ***@***.***>
Cc: Gary Isaac ***@***.***>; Mention ***@***.***>
Subject: Re: [AHRQ-CDS/AHRQ-CDS-Connect-PAIN-MANAGEMENT-SUMMARY] Javascript Required error (Issue #45)
Hi @Gary-Isaac<https://github.com/Gary-Isaac>. Have you been able to get this working?
—
Reply to this email directly, view it on GitHub<#45 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAYMLVP6SMKVTTN4LG3BZNDYHCFY5AVCNFSM6AAAAAA6XZF2D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZTHAZDOMJVGM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
A while back I suggested this:
Have you been able to try that? |
I have successfully built the app on Ubuntu server 22.04. I deployed it to production on Apache webserver on the same Ubuntu ec2 instance. The URL for the app opens with a blank page. The source shows an error stating Javascript needs to be enabled. Javascript is enabled in my browser. I did some research but could not resolve the error. I am using http://localhost in Package.json. Do you have any ideas on to resolve this issue? I can provide more details if necessary.
The text was updated successfully, but these errors were encountered: