Shinyapps.io on safari browser cannot connect to server "localhost " - r

I've created a basic app in shiny that connects and uploads data to a shared googlesheet. The app works fine locally, however when I try to run it in a web browser, it won't upload any data.
The problem seems pretty straight forward. Using shiny apps.io I can view the apps logs, and it identifies that I need to provide the app permission, (specifically shinyapps and tidyverse) to upload data to google sheets, which is authorized by google sheets. This is no problem as I went through the same process on my own machine locally:
1) I'm running on a Mac, OSX Mojave v 10.14.2
2) I've enabled web sharing via the terminal with sudo apachectl start (I think that's all it took?)
3) I've scoured similar problems on here.
4) The app opens and uploads data when I "view in browser" from the RStudio IDE
5) I wanted to try Shiny Server, however apparently they haven't written anything for Macs yet that doesn't have to built from source, which is way beyond my level.
6) The google sheet is published to the web as well.
This is the provided message from shinyapps.io logs
Listening on http://127.0.0.1:37073
2019-01-15T14:33:32.976569+00:00 shinyapps[636194]: Adding .httr-oauth to .gitignore
2019-01-15T14:33:33.012405+00:00 shinyapps[636194]: Please point your browser to the following url:
2019-01-15T14:33:33.010168+00:00 shinyapps[636194]: Waiting for authentication in browser...
2019-01-15T14:33:33.010485+00:00 shinyapps[636194]: Press Esc/Ctrl + C to abort
2019-01-15T14:33:33.012759+00:00 shinyapps[636194]: "This is the provided URL"
I then go to the provided URL, that takes me to a accounts.google page that asks me to provide authentication to a specific google account, which I do.
I then receive this error from safari:
Safari can't open the page "the provided URL" because safari cannot connect to the server "localhost"
I would basically like this app to be used only by the allowed google account which is a shared one and be able to upload from at most 3 different machines that are windows, Any help appreciated!

I've found a temporary work around, in my code since I take advantage of the google sheets package in R, it as a function called:
gs_title("worksheet title")
this allows the app to identify the worksheet that has been given access to the app, however this is a problem when uploading the app online, I used a different function called:
gs_url("worksheet URL as copied from search bar")
It passes the url of the worksheet apparently bypassing the local server problem, and allowing me to open the app from other machines.

Related

Shiny app disconnected from the server. No errors

I am running a Shiny app on Ubuntu using the free Shiny server.
When I view the app in a tab in a browser (on MacOS or iPhone) it works fine. If I leave the tab open for a few minutes and return to the tab, I see the familiar translucent grey overlay with a rectangular box in the lower left stating, "Disconnected from the server. Reload".
There are no error indicated at /var/log/shiny-server/app-name... or at /var/log/shiny-server.log.
Here's my shiny server config file:
# Define a server that listens on port 3838
server {
listen 3838;
# Define a location at the base URL
location / {
# Defines the amount of time (in seconds) an R process with no active connections should remain open.
app_idle_timeout 0;
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
Based on this post, I thought the addition of app_idle_timeout 0; would prevent this from happening. It hasn't.
Running /opt/shiny-server/bin/shiny-server --version results in:
Shiny Server v1.5.14.948
I understand Dean Attali has created, shinydisconnect, as a way to make this message look nicer. However, I am wondering how to prevent this message from appearing at all if no errors have occurred.
The "Disconnected from Server" error is a generic message that means that the R session has shut down for some reason. This could happen for a multitude of reasons, ranging from missing objects, to data that takes too long to load, to the use of forbidden packages, to hitting the application timeout settings.
The first thing you should do when encountering this error is check the application log. This can be accessed in the shinyapps.io dashboard, under the Logs tab in the Application view, or by running rsconnect::showLogs() in the RStudio console.
This log will contain information about the startup and running of your application. Any errors encountered along the way will be shown here, comparable to the log created when you run the shiny application locally in your own R process.
It may also help to check the Javascript console in your browser while the application is running, which may show additional errors and messages related to your application. The exact instructions for checking this will vary depending on your browser.
If you see errors related to the data, code, or workspace of the application, you will need to fix them before the application will load properly. Remember that applications deployed to shinyapps.io must be independent and self-contained, so all the data, workspace objects, and other resources that the app needs must be deployed with it, or accessible via the internet.
Even if there is no error in the application log, the problem may still lie within your code. There are many resources available online to assist you in debugging and optimizing your app, including our Debugging Shiny Applications article, and the shinyapps-users Google group.
Be aware that your app may run well locally, but fail on shinyapps.io once it comes under load from multiple users. This could happen for a variety of reasons, including but not limited to:
Forgetting to close each database connection after loading in data
Making multiple long-running calls to a public API
Sub-optimal application instance or worker provisioning
Finally, our Scaling and Tuning article describes best practices regarding optimizing the performance of your shinyapps.io application.

Firebase serve does not update Service Worker

When I do a firebase init at command line, and create a standard web page, then a firebase serve, then open http://localhost:5000. I usually get a web page that I was working on at previous time. I am almost certain this is from a previous version of serviceworker.js.
Also depends on which browser I am using on my Mac (Safari, Chrome, Firefox and Opera), they will get different results. My feeling is that there should be a ServiceWorker.js clear or reset command so that a new serviceworker.js will be created. So Question, is there a SW reset command someplace. Ideally at the command line?
Or am I just nuts?
Since the Service Worker registration lives entirely within the browser, there's no way for the firebase serve command to know that you've made changes.
To clear all local stored data including Service Worker registrations (for Chrome at least), you can open the web inspector, go to the "Application" tab, and click the "Clear site data" button. Safari does not yet support Service Worker, so you shouldn't see the same behavior there.
If you're working on multiple web apps at the same time, you might want to consider using different ports for each, e.g. firebase serve -p 5001 for a second app.

Windows Explorer not refreshing after CreateFolder (new folder)

We have built a WebDav Service with your Engine and have a one problem when we create a new Folder or File:
The new folder / file is created successfully, but not showing in the Windows Explorer. Only if you press F5, the new folder / file is showing (and the name is already selected to be edited).
This behavior is reproducible even with a blank WebDav Solution.
We can reproduce this on Windows 7 and Windows 8 (8.1) using WebDav .NET Server 3.8 and the latest 3.9.
Is there a way to get around this “refresh-problem”?
I solved this issue but clicking in the folder explorer at view > options > then i restored to default and everything is back to normal.
I assume this issue is in Windows Explorer on a single computer. Most likely the WebDAV server-side code is failing with with some exception. Here are some ideas how to detect what is wrong:
Unmount network connections executing 'net use * /DELETE' in a command prompt, this will unmount WebDAV connections too and simulate 'clean' environment.
Retry reproducing the issue and examine your WebDAV logfile. By default it is located in /App_Data/WebDAV/Logs/ folder. Are there any exceptions in it?
Use Fiddler tool or any other debugging proxy to capture and examine HTTP requests. Are there any failed requests?
In case you are creating a folder/file on one computer using Windows Explorer (Microsoft Mini-redirector driver) or IT Hit Ajax File Browser and expect the files list to refresh automatically on another computer this would not work. Mini-redirector does not support any notifications from server and WebDAV does not submit any notifications, you need to refresh the files list manually to see the new items created.
I found this video on Youtube that explains in very much detail how to fix this problem: https://www.youtube.com/watch?v=UUiCPsQquqc
It is a bit lengthy, so I'll just quickly sum it up here:
The reason for these problems are one or more (broken) Shell Extensions that prevent the refresh of the Windows Explorer
To fix it, open up regedit.exe (requires admin privileges), do a search for the Registry Key "DontRefresh". If it is "1", set it to "0". There might be multiple matches for that Key, so repeat until all Keys have the value "0".
This might not work immediately, you may have to kill and restart your explorer.exe process (easiest to do with the Task Manager). Or you can simply reboot your computer. In my case, it worked immediately.
According to the video, the Keys should only be located under HKEY_CLASSES_ROOT/CLSID, but in my case I could only find such Keys in HKEY_LOCAL_MACHINE/Classes/Wow6432Node/CLSID.
I figured it makes most sense to simply search the complete Registry, it does not take very long.
I tred a lot of hacks, from scanning the system, to recreating the profile to hacking Registry keys and hives.
Finally what worked for me -
Right click on desktop
Select Personalize
Click Themes
Click Change desktop icons
Click Restore default & OK
And instantly it began to auto refresh with a new folder, rename, delete, copy, etc.

Using IIS Express for Local Web Application with Multiple Users [duplicate]

I have a line of code that I can run locally as part of a service that works perfectly fine.
sReportPath = objCrystalUtils.ExportReportToPDF("Report Name", iReportInfoID)
This code is run as a part of a service, and when I unit test it by feeding it data, it ultimately builds the report and prints it.
When I run the exact same piece of code inside an .ashx from an ajax call. The reports are generated (I can see the pdf files being created on disk) but the printing is not happening.
oRpt.PrintToPrinter(objReport.DefaultAutoPrint, True, 0, 0)
In both scenarios the same code is used to print the report. (objReport.DefaultAutoPrint = 0 in both cases)
My only thought is that the location of the code that is calling this method is in a different spot relative to the location of the bills themselves.
The printer that I'm trying to print to is a network printer intalled on my machine, and I'm running Windows 7 IIS 6.1
Any thoughts?
Edit:
Here is a thought... if I'm running one as a unit test locally and im running the other through a web app that is running via IIS, is there a difference in user id and user access to the default printer?
Edit:
So I added my local ASP, IUSR and SYSTEM users to the printer security and allowed them to print... no dice. So I checked the EVERYONE user and it is set to access and NO users are denied... so I think that kinda kills that line of reasoning.
Edit:
I changed the name of this post since I no longer think that the issue is ajax related since If I try to do the same process in code bebehind from a post back instead of running it from an ajax call i still get the same problem.
Patrick, for me it is a known issue of crystal reports, printing a certain report from a running application via IIS.
I got the same issue before, and upon our search for that issue, we got the following;
Report to be generated, exported, and then to be downloaded to client machine,
so user can print it locally (say, report will be exported as PDf file,
user can use print option of PDF reader).
It's not Crystal Reports or other third party app's problem. It's usually the IIS_IUSER's permission problem because it has no access to any network printers. A possible solution is in Process.Start doesn't work in IIS

Launch Client Console App from Web Page

I've been asked to launch a Console App from a WebPage. Sounds hairy, but there is sound logic for it.
Basically, the page is a Dashboard page which only super admins can access. We have a Console app which needs to run on the client machine. It cannot run headlessly on the server.
I figured I'd have some kind of small file which is downloaded upon the button click. Then that file could be run from the resulting dialog which would launch the exe.
I know apple does something like that with podcasts. You can subscribe by downloading a small link that would behave as I described and open iTunes.
I had a quick go using ClickOnce, publishing the application to IISExpress where I had my site up and running, but had no success with that.
Is ClickOnce the way to go, or is there some other easier approach?
I've also tried just adding a shortcut with a link to that shortcut nd adding .lnk as a mime type in IIS with mimeType="application/octet-stream". I had no luck there and received a 404 error which I have not been able to resolve yet.
Edit
I should also mention that the Console application is not just a single exe assembly. It has dependencies on a bunch of other 3rd party dlls.
I am assuming here that this desktop application needs to be executed at client side. Thus it will be installed by you or someone in your department i.e available to download.
If it is the case then what you need is to register URI - just like skype URI where href="skype:28347839" lanuches skype automatically.
For reference please click here: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx
otherwise, get clickonce - -choice is yours.
As you say, just put the console application (an .exe file) on the server, and link to it in a webpage. When the user clicks on the link the exe file will be downloaded. The user can then run the exe file on their own computer.
There will be some warning dialogs about security issues, but if your users trust your exe then they can accept those warnings.
If you get the console application signed, and/or maybe use Group Policy on your LAN you might be able to reduce or eliminate those warnings.

Resources