我无法渲染我的图像。我将受保护的图像上传到 S3,没问题。然后我使用下面的代码来检索图像。当我记录 imageReturn 时,我得到带有令牌的图像 URL。
state = {
image: ''
}
async getImage(image) {
let imageReturn = await Storage.get('9807139f-e5b4-428e-8dfb-d7cfeebe87ab.jpeg')
this.setState({
image: imageReturn
})
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试以两种不同的方式渲染图像,使用 react-native 的 Image 和使用 'aws-amplify-react-native' S3Image。
<Image source={this.state.image} style={{ width: 100, height: 100 }}/>
Run Code Online (Sandbox Code Playgroud)
和
<S3Image key={'9807139f-e5b4-428e-8dfb-d7cfeebe87ab.jpeg'} />
Run Code Online (Sandbox Code Playgroud)
任何和所有的帮助表示赞赏。谢谢!
当尝试使用 docker-compose 将我的 Express 应用程序连接到 mongo 容器时,连接被拒绝。我可以使用 localhost:27017 连接到带有 robo3T 的 db 容器,并使用 dbSetup.js 进行 l/p 设置,但是当 express 尝试连接时,出现错误:
{ MongoNetworkError:第一次连接时无法连接到服务器 [mongo:27017] [MongoNetworkError: connect ECONNREFUSED 172.19.0.2:27017]
// mongoose
const options = {
autoIndex: true, // Don't build indexes
reconnectTries: Number.MAX_VALUE, // Never stop trying to reconnect
reconnectInterval: 500, // Reconnect every 500ms
poolSize: 10, // Maintain up to 10 socket connections
// If not connected, return errors immediately rather than waiting for reconnect
bufferMaxEntries: 0
};
console.log(options);
mongoose.connect('mongodb://blogUser:blogUserPassword@mongo/blog', options).then(
() …Run Code Online (Sandbox Code Playgroud)