eurostat icon indicating copy to clipboard operation
eurostat copied to clipboard

Error when deployed on shinyapps.io

Open velkokamenov opened this issue 5 years ago • 3 comments

Hi guys,

Thanks for the great package, I've been using it for the last couple of months.

I have developed a shiny application leveraging on data from eurostat pulled in R with the eurostat package. Locally everything runs perfectly and with no errors (for versions 3.3.1 as well as 3.1.5 of the eurostat package and version 3.3 of R).

However, when deployed on shinyapps,io I got the following error on my logs:

Warning in open.connection(con, "rb") : "internal" method cannot handle https redirection to: 'https://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing?sort=1&downfile=table_of_contents_en.txt' Stack trace (innermost first): Warning: Error in open.connection: cannot open the connection

And the application cannot be run.

The two functions I am using from the package are get_eurostat() and label_eurostat().

Any ideas why the problem within shinyapps.io framework exists?

I have deployed an older version of the same application in March 2018 and back then everything worked with no errors so I guess it is related in some way to changes in Eurostat API since then which are not addressed by shinyapps.io capabilities.

I would appreciate any ideas about possible workarounds.

Best Regards,

Velko

velkokamenov avatar Dec 27 '18 12:12 velkokamenov

I think it could be that your application is trying to get a data with wrong data id. With right id, there shouldn't be any redirections to that address.

jhuovari avatar Dec 27 '18 21:12 jhuovari

I don't believe the reason to be a wrong id since locally I do manage to get all the tables with data using the get_eurostat() function.

Anyway I managed to find a working solution for the moment which I hope may prove helpful for others struggling with the same problem in the future.

The problem with my application was lying somewhere in the label_eurostat() function or in its internal get_eurostat_dic() I cannot be 100% sure where exactly since I can't reproduce the error on my machine locally and it was only present after deploying the app on shinyapps.io.

So what solved my problem was that I downloaded manually all the eurostat dictionaries from the following link : https://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing?sort=1&dir=dic

After that I created my own version of the label_eurostat() function using some of the .dic files downloaded locally from the presented link.

Hence I excluded label_eurostat() from my code and alternatively used the newly created function utilizing the locally available .dic files to map the geo and unit columns with their respective full meanings.

After these steps I was able to successfully deploy the application on shinyapps.io.

I would share the full project codes and files in a separate github repository soon.

velkokamenov avatar Dec 28 '18 18:12 velkokamenov

Is this is something that could be realistically solved in the package itself? Otherwise, if there was a clear description we could add it in the tutorial to help others.

antagomir avatar Jan 26 '20 09:01 antagomir