I have a working Shiny App that queries a remote MySQL database via pool
that I can run on my local machine.
The MySQL I'm querying server has whitelisted shinyapps.io IP addresses.
When I deploy this app to shinyapps_io, why do I get the following error and what are some troubleshooting steps?
Here are my files:
.global
library(shiny)
library(DBI)
library(pool)
library(DT)
pool <- dbPool(
drv = RMySQL::MySQL(),
dbname = "some_name",
host = "some.host.com",
username = "some_username",
password = "password"
)
onStop(function() {
poolClose(pool)
})
.server
shinyServer(function(input, output, session) {
output$data_table <- renderDataTable({
DT::datatable(pool %>% tbl("small_data") %>% collect())
})
.ui
shinyUI(
fluidPage(
mainPanel(DT::dataTableOutput("data_table"))
)
)
1 Like
Hi, just to confirm the Host address in the real app is an Internet IP or URL, not the internal VPC IP or URL.
1 Like
Hi Edgar, and thanks for asking.
I confirmed with my system admin that the host IP I'm using to query the database is indeed a public IP (169.237.35.237), and it's a FQDN.
Any ideas what might cause this behavior?
UPDATE: It works now. My system admin added a port, and that fixed the issue.
For anyone down the line that is running into this issue, there are the steps I recommend:
- make sure your shinyapp works locally
- if you get deployment errors on shinyapps.io, make sure:
- your database has whitelisted shinyappsio IP addresses
- your host is an external, public IP or URL and not an internal one
- some institutions have very guarded firewalls. Try adding a port to your database.
I hope this helps someone down the line!
pool <- dbPool(
drv = RMySQL::MySQL(),
dbname = "some_name",
host = "some.host.com",
username = "some_username",
password = "password",
port = 1234567
)
4 Likes