小编And*_*Wei的帖子

是否可以使用帖子正文发布到SQS网址

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html

https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue/
?Action=SendMessage
&MessageBody=This+is+a+test+message
Run Code Online (Sandbox Code Playgroud)

这工作正常,但是可以使用帖子体发送有效载荷吗?

我有一个外部服务在post体中发送json有效负载(吞吐量非常高).如果我可以直接向他们提供SQS网址,并且避免必须创建AWS api网关 - > lambda - > SQS堆栈,那将是理想的选择.

我愿意接受其他解决方案.

amazon-web-services aws-lambda

6
推荐指数
1
解决办法
3684
查看次数

AWS Api Gateway 作为 HTTP 代理正在破坏二进制上传的图像文件

我有一个 ruby​​ on rails 应用程序,它接收一个图像文件,“将它附加到一个成员”,然后将它上传到 s3。当我使用 insomnia 和 POST 直接到应用程序时......它可以工作,但是当我在 AWS Api Gateway 后面使用完全相同的端点时,图像已损坏且无法查看。


这是请求的比较。

  • LEFT = 直接发布到 rails 应用程序
  • RIGHT = 通过 api 网关

https://www.diffchecker.com/wwUmpB5W

我注意到的是,回形针 gem 正在运行不同的命令。很明显,回形针在通过 API 网关时意识到文件不是图像。


以下是一些可能相关的屏幕截图

方法执行 整合请求 api网关设置


这是导轨代码:

def create
  logger.info 'upload_attachment_api_general_v1'
  logger.info params
  logger.info request.env
  @file = current_merchant.members.find(params[:member_id]).attachments.new(file: params[:file], label: params[:label])
  if params[:file] && @file.save
    render json: @file
  else
    render json: @file.errors, status: :unprocessable_entity
  end
end
Run Code Online (Sandbox Code Playgroud)

paperclip amazon-web-services aws-api-gateway api-gateway

6
推荐指数
1
解决办法
3045
查看次数

手动生成Rails缓存密钥

我正在尝试使用孤立的工作程序来构建和操作我的缓存.我想让这些工人尽可能地精益求精.(不要使用铁轨)

我很难伪造rails生成的缓存键

在我看来,我有这个:

cache ["comments", @ama]
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下内容复制它生成的密钥:

updated_at = Time.parse(row['updated_at'])
timestamp = updated_at.utc.strftime('%Y%m%d%H%M%S')
cache_key = "views/comments/amas/#{row['id']}-#{timestamp}"
Run Code Online (Sandbox Code Playgroud)

哪个会产生:

views/comments/amas/432-20121227010114
Run Code Online (Sandbox Code Playgroud)

该密钥的缓存为空.

要么我没有正确格式化我的密钥,要么缺少缓存.我有95%的信心我正在寻找的缓存就在那里.

(我可以使用诸如'test'之类的密钥来推送缓存,然后将其恢复.所以我知道缓存正在运行)

有用的参考:

有用的信息:

  • 缓存服务器不是本地的,是的,我指的是它.
  • 即使密钥不存在,当我在生产中加载页面时,密钥和缓存也会在现场构建.我试过了.
  • 使用Rails 4.0.0

ruby memcached caching ruby-on-rails-3 ruby-on-rails-4

4
推荐指数
2
解决办法
7076
查看次数

Heroku Rails 4/Ruby 2.0.0部署失败,生产数据库无法连接

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       could not connect to server: Connection refused
       Is the server running on host "127.0.0.1" and accepting
       TCP/IP connections on port 5432?
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:796:in `initialize'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:796:in `new'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:796:in `connect'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:513:in `initialize'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_handling.rb:53:in `connection'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/model_schema.rb:203:in `table_exists?'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb:5:in `included'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:98:in `include'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:98:in `taggable_on'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:39:in `acts_as_taggable_on'
       /tmp/build_5h4sx2s7f96x/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:15:in …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku ruby-on-rails-4

1
推荐指数
1
解决办法
1343
查看次数