gpt4 book ai didi

ruby-on-rails - 为什么 `rake assets:precompile` 抛出 "getaddrinfo: Name or service not known"? (重新 : asset_sync)

转载 作者:行者123 更新时间:2023-12-04 06:15:15 24 4
gpt4 key购买 nike

我正在尝试设置我的 rails 应用程序以使用 asset_sync 将其 Assets 上传到亚马逊的 AWS S3 gem ,关注 these instructions .我知道我已经正确配置了我的 S3 内容,因为我的应用程序可以将图像上传到 S3。我很确定我的所有设置都正确:

FOG_DIRECTORY => mybucketname
FOG_PROVIDER => AWS
FOG_REGION => s3-us-west-2

但是我不断收到错误消息:
-bash> heroku run rake assets:precompile --remote staging
Running rake assets:precompile attached to terminal... up, run.1
AssetSync: using default configuration from built-in initializer
mkdir -p /app/public/assets
...
mkdir -p /app/public/assets
AssetSync: Syncing.
rake aborted!
getaddrinfo: Name or service not known # <-- error

在本地编译会产生稍微不同的错误:
-bash> bundle exec rake assets:precompile
AssetSync: using default configuration from built-in initializer
mkdir -p /Users/bart/Dev/MyApp/myapp/public/assets
...
mkdir -p /Users/bart/Dev/MyApp/myapp/public/assets
AssetSync: Syncing.
rake aborted!
getaddrinfo: nodename nor servname provided, or not known # <-- error

最佳答案

我将错误追溯到 a 'connection' line in Fog ,其中之一 asset_sync的运行时依赖项,结果是 我的 FOG_REGION设置不正确 .就我而言,该地区应该是 us-west-2 ,不是 s3-us-west-2 .

自从我配置我的 S3 帐户已经有一段时间了,所以我首先尝试通过登录 AWS S3 控制台,单击存储桶名称,然后单击“属性”来确定我使用的区域。在那里,该地区被列为俄勒冈州。嗯,那没有用。然后,我单击现有存储桶之一的对象和文件夹浏览器,直到找到一项 Assets ,查找其“属性”,并看到“链接”:

https://s3-us-west-2.amazonaws.com/mybucketname/uploads/mymodel/image/1135/myimage.jpg

我确信 s3-us-west-2是正确的,直到我注意到 Fog adds the s3- prefix .

无论如何,我现在知道一旦您通过名称找到您所在的地区(例如俄勒冈州),您就可以在 this list of S3 regions 中查找。 (它是位置约束列下的名称)。

我希望这可以帮助别人。

关于ruby-on-rails - 为什么 `rake assets:precompile` 抛出 "getaddrinfo: Name or service not known"? (重新 : asset_sync),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11799366/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com