[英]How to connect AWS S3 credentials in a modular shiny app
Running a shiny app with multiple folders served on shinyapps.io. 在shinyapps.io上运行一个有多个文件夹的闪亮应用程序。 The app has a function which pulls data from S3 (using a wrapper around get_bucket()
), which works fine locally as I set the AWS secret and credentials in my project .Renviron file, but once pushed I get a HTTP 403 error: 该应用程序有一个从S3中提取数据的功能(使用get_bucket()
周围的包装器),当我在我的项目.Renviron文件中设置AWS秘密和凭据时,它在本地工作正常,但一旦推送我得到HTTP 403错误:
Error in value[[3L]](cond) : Forbidden (HTTP 403).
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Things I have tried: 我尝试过的事情:
get_bucket()
call 直接在get_bucket()
调用中包含aws键,secret和region sys.setenv()
在global.R文件中设置凭据,其中包括sys.setenv()
I'm completely out of ideas on this one. 我完全没有关于这个的想法。 It stems into a broader question of how to set .Renviron variables in a shinyapps.io app. 它引发了一个更广泛的问题,即如何在shinyapps.io应用程序中设置.Renviron变量。 Things I've read say to add to the main folder or other options, but as I say above hasn't worked. 我读过的东西说要添加到主文件夹或其他选项,但正如我上面说的那样没有用。
I am reading the data in with shiny::reactivePoll()
but don't see how this is the issue. 我正在使用shiny::reactivePoll()
读取数据,但是看不出这是怎么回事。
Thanks for your help, been stuck on this for days. 谢谢你的帮助,坚持了好几天。
So, all along, the answer was in directly calling Sys.getenv()
in the get_bucket()
所以,一直Sys.getenv()
,答案是在Sys.getenv()
中直接调用get_bucket()
get_bucket(s3BucketName,
"AWS_ACCESS_KEY_ID" = Sys.getenv("AWS_ACCESS_KEY_ID"),
"AWS_SECRET_ACCESS_KEY" = Sys.getenv("AWS_SECRET_ACCESS_KEY")
Which could call on the .Renviron I had in the main directory. 哪个可以调用我在主目录中的.Renviron。 I think in my previous attempts I had either a) not called on it correctly with Sys.getenv()
or forget to address it properly. 我认为在我以前的尝试中我或者a)没有使用Sys.getenv()
正确调用它,或者忘记正确地解决它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.