I have created a Node API using MySQL and deployed it on Heroku. But after every 20-25 minutes it shows 'Application error' and I have to do 'Heroku restart' again to fetch data from API. My API calls work fine when runs on localhost:port_no
Heroku Logs
>2021-06-26T04:15:47.965652+00:00 heroku[web.1]: State changed from starting to up
2021-06-26T04:20:47.759660+00:00 app[web.1]: events.js:353
2021-06-26T04:20:47.759669+00:00 app[web.1]: throw er; // Unhandled 'error' event
2021-06-26T04:20:47.759670+00:00 app[web.1]: ^
2021-06-26T04:20:47.759670+00:00 app[web.1]:
2021-06-26T04:20:47.759670+00:00 app[web.1]: Error: Connection lost: The server closed the connection.
2021-06-26T04:20:47.759671+00:00 app[web.1]: at Protocol.end (/app/node_modules/mysql/lib/protocol/Protocol.js:112:13)
2021-06-26T04:20:47.759672+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:94:28)
2021-06-26T04:20:47.759672+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:526:10)
2021-06-26T04:20:47.759673+00:00 app[web.1]: at Socket.emit (events.js:388:22)
2021-06-26T04:20:47.759673+00:00 app[web.1]: at endReadableNT (internal/streams/readable.js:1336:12)
2021-06-26T04:20:47.759674+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21)
2021-06-26T04:20:47.759674+00:00 app[web.1]: Emitted 'error' event on Connection instance at:
2021-06-26T04:20:47.759676+00:00 app[web.1]: at Connection._handleProtocolError (/app/node_modules/mysql/lib/Connection.js:423:8)
2021-06-26T04:20:47.759677+00:00 app[web.1]: at Protocol.emit (events.js:376:20)
2021-06-26T04:20:47.759678+00:00 app[web.1]: at Protocol._delegateError (/app/node_modules/mysql/lib/protocol/Protocol.js:398:10)
2021-06-26T04:20:47.759678+00:00 app[web.1]: at Protocol.end (/app/node_modules/mysql/lib/protocol/Protocol.js:116:8)
2021-06-26T04:20:47.759679+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:94:28)
2021-06-26T04:20:47.759679+00:00 app[web.1]: [... lines matching original stack trace ...]
2021-06-26T04:20:47.759679+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21) {
2021-06-26T04:20:47.759680+00:00 app[web.1]: fatal: true,
2021-06-26T04:20:47.759680+00:00 app[web.1]: code: 'PROTOCOL_CONNECTION_LOST'
2021-06-26T04:20:47.759681+00:00 app[web.1]: }
2021-06-26T04:20:47.817878+00:00 heroku[web.1]: Process exited with status 1
2021-06-26T04:20:47.876488+00:00 heroku[web.1]: State changed from up to crashed
My connection.js file
const mysql = require('mysql');
var sqlConnection = mysql.createConnection({
host: ##,
user:##,
password: ##,
database: ##,
multipleStatements: true
});
sqlConnection.connect((err) => {
if (!err) {
console.log("Connected");
} else {
console.log("Connection Failed");
}
})
module.exports = sqlConnection;
```
I've deployed a parse-server app in Heroku that I'd been developing locally using Docker. This app uses push notifications, and so needs access to some crypto data to play with APNs.
Locally I mounted a volume with the token key file in it. On Heroku this isn't an option, and I don't want to bundle the key in the package unencrypted. I've been trying to encode the token key in the JSON argument to the "PARSE_SERVER_PUSH" environment variable in different ways. It seems what's needed is a Buffer, but I have no idea how to represent such a thing in JSON, and I haven't found anything through some searching.
I'm currently using this at my push config:
{"ios":
{
"token": {
"key": {"type":"Buffer","data":[45, 45, ... 45]},
"keyId": "MYKEYID",
"teamId": "MYTEAMID"
},
"topic": "com.myApp",
"production": false
}
}
But the server chokes on the 'key' field:
2019-01-23T19:47:36.725181+00:00 app[web.1]: VError: Failed loading token key: path must be a string or Buffer
2019-01-23T19:47:36.725191+00:00 app[web.1]: at prepareToken (/parse-server/node_modules/apn/lib/credentials/token/prepare.js:15:13)
2019-01-23T19:47:36.725193+00:00 app[web.1]: at config (/parse-server/node_modules/apn/lib/config.js:43:31)
2019-01-23T19:47:36.725194+00:00 app[web.1]: at new Client (/parse-server/node_modules/apn/lib/client.js:21:19)
2019-01-23T19:47:36.725195+00:00 app[web.1]: at new Provider (/parse-server/node_modules/apn/lib/provider.js:12:19)
2019-01-23T19:47:36.725201+00:00 app[web.1]: at Function._createProvider (/parse-server/node_modules/#parse/push-adapter/lib/APNS.js:251:22)
2019-01-23T19:47:36.725203+00:00 app[web.1]: at new APNS (/parse-server/node_modules/#parse/push-adapter/lib/APNS.js:81:29)
2019-01-23T19:47:36.725204+00:00 app[web.1]: at new ParsePushAdapter (/parse-server/node_modules/#parse/push-adapter/lib/ParsePushAdapter.js:65:40)
2019-01-23T19:47:36.725205+00:00 app[web.1]: at loadAdapter (/parse-server/lib/Adapters/AdapterLoader.js:31:16)
2019-01-23T19:47:36.725206+00:00 app[web.1]: at loadAdapter (/parse-server/lib/Adapters/AdapterLoader.js:24:12)
2019-01-23T19:47:36.725207+00:00 app[web.1]: at getPushController (/parse-server/lib/Controllers/index.js:230:54)
Does anybody know how to achieve this?
EDIT: The documentation (https://github.com/node-apn/node-apn/blob/master/doc/provider.markdown) suggests it's possible:
token.key {Buffer|String} The filename of the provider token key (as
supplied by Apple) to load from disk, or a Buffer/String containing
the key data.
I'am trying to use ruby gem net-ssh and receive the error described bellow
jruby-9.1.15.0 :001 > require "net/ssh"
=> true
jruby-9.1.15.0 :002 > Net::SSH.start('myhost.dev', 'username' password: 'password', verbose: Logger::DEBUG){|ssh| puts ssh.exec!('hostname')}
D, [2018-01-17T14:24:29.633089 #26123] DEBUG -- net.ssh.transport.session[7d0]: establishing connection to myhost.dev:22
D, [2018-01-17T14:24:29.884816 #26123] DEBUG -- net.ssh.transport.session[7d0]: connection established
I, [2018-01-17T14:24:29.888234 #26123] INFO -- net.ssh.transport.server_version[7d2]: negotiating protocol version
D, [2018-01-17T14:24:29.888926 #26123] DEBUG -- net.ssh.transport.server_version[7d2]: local is `SSH-2.0-Ruby/Net::SSH_4.2.0 java'
D, [2018-01-17T14:24:29.952538 #26123] DEBUG -- net.ssh.transport.server_version[7d2]: remote is `SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8'
NotImplementedError: unsupported key type `ecdsa-sha2-nistp256'
from /home/qpi/.rvm/gems/jruby-9.1.15.0#some_gem/gems/net-ssh-4.2.0/lib/net/ssh/buffer.rb:286:in `read_keyblob'
Error was raised from buffer.rb:286:in read_keyblob.
Here the part of code which raising the error
unless defined?(OpenSSL::PKey::EC)
raise NotImplementedError, "unsupported key type `#{type}'"
Ok.. lets check, defined OpenSSL::PKey::EC or not:
jruby-9.1.15.0 :003 > defined?(OpenSSL::PKey::EC) ? 'defined' : 'not defined'
=> "defined"
What am I doing wrong?
When i use ruby (not jruby), everything works fine
Not a real solution but I found a hack that does the trick for me.
https://github.com/jruby/jruby-openssl/issues/105
In short, before your Net::SFTP.start, put these 2 lines.
Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }
and your problem should be gone.
I'm trying to use the chef mysql recipe but I keep getting an error, undefined method '[]' for nil:NilClass.
mysql.rb
mysql_service 'mysql' do
port '3306'
version '5.7.10'
initial_root_password 'SuperSecretPassword'
action [:create, :start]
end
mysql_config 'foo' do
source 'wp-config.php.erb'
notifies :restart, 'mysql_service[mysql]'
action :create
end
errr log
Recipe: wp::mysql
* mysql_service[mysql] action create
================================================================================
Error executing action `create` on resource 'mysql_service[mysql]'
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/root/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:380:in `package_name_for'
/root/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:421:in `server_package'
/root/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:432:in `server_package_name'
/root/chef-solo/cookbooks-2/mysql/libraries/provider_mysql_service_base.rb:31:in `block in <class:MysqlServiceBase>'
Resource Declaration:
---------------------
# In /root/chef-solo/cookbooks-3/wp/recipes/mysql.rb
5: mysql_service 'mysql' do
6: port '3306'
7: version '5.7.10'
8: initial_root_password 'ZH9D3nHE9gm1gFIgKdDC'
9: action [:create, :start]
10: end
11:
Compiled Resource:
------------------
# Declared in /root/chef-solo/cookbooks-3/wp/recipes/mysql.rb:5:in `from_file'
mysql_service("mysql") do
action [:create, :start]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :mysql_service
cookbook_name :wp
recipe_name "mysql"
port "3306"
version "5.7.10"
initial_root_password "ZH9D3nHE9gm1gFIgKdDC"
end
Running handlers:
[2016-01-17T12:04:43-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-01-17T12:04:43-05:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 04 seconds
[2016-01-17T12:04:43-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-01-17T12:04:43-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-01-17T12:04:43-05:00] ERROR: mysql_service[mysql] (wp::mysql line 5) had an error: NoMethodError: undefined method `[]' for nil:NilClass
[2016-01-17T12:04:43-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.
That method is involved with looking up the package names for the current platform et al. Likely means you are trying to use an OS/distro the cookbook does not support.
I'm following Michael Hartl's Rails tutorial and I'm trying to get the user to be able to upload images. It works fine on the rails server, but when I deploy to Heroku it uses S3 to handle the images. The upload fails with a 403 error. Here are the logs:
2015-01-29T10:31:39.129339+00:00 app[web.1]: (2.0ms) SELECT COUNT(*) FROM "microposts" WHERE (user_id = 101)
2015-01-29T10:31:39.125076+00:00 app[web.1]: Rendered shared/_error_messages.html.erb (0.1ms)
2015-01-29T10:31:39.138938+00:00 app[web.1]: CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:31:39.155276+00:00 app[web.1]: Rendered shared/_feed.html.erb (28.9ms)
2015-01-29T10:31:39.169708+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.1ms)
2015-01-29T10:31:39.183946+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.1ms)
2015-01-29T10:31:39.197655+00:00 heroku[router]: at=info method=GET path="/" host=mysterious-oasis-7816.herokuapp.com request_id=4c2cbe41-3b26-4e37-9ef9-f07ec6e963a6 fwd="76.102.7.62" dyno=web.1 connect=3ms service=109ms status=200 bytes=4525
2015-01-29T10:31:39.369193+00:00 heroku[router]: at=info method=GET path="/assets/application-3ac07d30cc871c78233de32e71487cf3.js" host=mysterious-oasis-7816.herokuapp.com request_id=6cd2bfa0-424b-4456-9cfb-822b515d3bcc fwd="76.102.7.62" dyno=web.1 connect=1ms service=4ms status=304 bytes=241
2015-01-29T10:31:39.365503+00:00 heroku[router]: at=info method=GET path="/assets/application-cbf43ddf42ea7f553995264124e0cacf.css" host=mysterious-oasis-7816.herokuapp.com request_id=d7df3d86-0cf4-444b-bce8-8b164c2dbef6 fwd="76.102.7.62" dyno=web.1 connect=1ms service=3ms status=304 bytes=227
2015-01-29T10:31:39.598181+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-oasis-7816.herokuapp.com request_id=386ad300-9cd9-43e7-8112-f918d7c3a7df fwd="76.102.7.62" dyno=web.1 connect=2ms service=2ms status=304 bytes=156
2015-01-29T10:31:46.517236+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:31:46 +0000
2015-01-29T10:31:46.519545+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:31:46.519617+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77ae5d1d80 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-12-b07k07.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:31:46.521720+00:00 app[web.1]: User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:31:46.836156+00:00 app[web.1]: (1.5ms) BEGIN
2015-01-29T10:31:46.841095+00:00 app[web.1]: SQL (1.7ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "201
5-01-29 10:31:46.837765"], ["updated_at", "2015-01-29 10:31:46.837765"]]
2015-01-29T10:31:48.433575+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=d7e1b8ee-3e5d-45ef-9578-4f242fd160db fwd="76.102.7.62" dyno=web.1 connect=1ms service=2239ms status=500 bytes=1786
2015-01-29T10:31:48.427961+00:00 app[web.1]: (1.3ms) ROLLBACK
2015-01-29T10:31:48.431863+00:00 app[web.1]:
2015-01-29T10:31:48.431866+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:31:48.431868+00:00 app[web.1]: excon.error.response
2015-01-29T10:31:48.431870+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2E3F56207B398181</RequestId><HostId>XIDq0YLLZd8ZdGB1mTuUiofj5vh0V4lt5hb/jow79dysteI26fEr/gNMpGqF5qCv0zPmFiEYtCY=</HostId></Error>"
2015-01-29T10:31:48.431871+00:00 app[web.1]: :headers => {
2015-01-29T10:31:48.431873+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:31:48.431874+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:31:48.431875+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:31:47 GMT"
2015-01-29T10:31:48.431878+00:00 app[web.1]: "x-amz-id-2" => "XIDq0YLLZd8ZdGB1mTuUiofj5vh0V4lt5hb/jow79dysteI26fEr/gNMpGqF5qCv0zPmFiEYtCY="
2015-01-29T10:31:48.431879+00:00 app[web.1]: "x-amz-request-id" => "2E3F56207B398181"
2015-01-29T10:31:48.431881+00:00 app[web.1]: }
2015-01-29T10:31:48.431882+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:31:48.431883+00:00 app[web.1]: :local_port => 34183
2015-01-29T10:31:48.431885+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:31:48.431877+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:31:48.431890+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:31:48.431891+00:00 app[web.1]:
2015-01-29T10:31:48.431892+00:00 app[web.1]:
2015-01-29T10:31:48.431886+00:00 app[web.1]: :remote_ip => "54.231.160.162"
2015-01-29T10:31:48.431887+00:00 app[web.1]: :status => 403
2015-01-29T10:31:48.431889+00:00 app[web.1]: ):
2015-01-29T10:31:48.429838+00:00 app[web.1]: Completed 500 Internal Server Error in 1910ms
2015-01-29T10:46:55.496986+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-oasis-7816.herokuapp.com request_id=2a227f3f-20da-405f-b150-f4e4cbc62c0c fwd="76.102.7.62" dyno=web.1 connect=1ms service=1ms status=304 bytes=156
2015-01-29T10:46:57.592699+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:46:57.592801+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77b148e678 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-6-kbjdeu.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:46:57.595260+00:00 app[web.1]: User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:46:57.589391+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:46:57 +0000
2015-01-29T10:46:57.898731+00:00 app[web.1]: (1.4ms) BEGIN
2015-01-29T10:46:57.906703+00:00 app[web.1]: SQL (2.1ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "2015-01-29 10:46:57.900611"], ["updated_at", "2015-01-29 10:46:57.900611"]]
2015-01-29T10:46:59.548010+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=e7867249-ff62-4fa0-bf0e-9dadd9134640 fwd="76.102.7.62" dyno=web.1 connect=1ms service=2273ms status=500 bytes=1786
2015-01-29T10:46:59.542346+00:00 app[web.1]: (1.4ms) ROLLBACK
2015-01-29T10:46:59.546576+00:00 app[web.1]:
2015-01-29T10:46:59.546579+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:46:59.546581+00:00 app[web.1]: excon.error.response
2015-01-29T10:46:59.546583+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>6B6A73213C176F40</RequestId><HostId>QDnWZ627/2/Wuf7z4nuQnS/u+ysezUG/o2IqDnO9hgAJBJF+H3h4uexFerBeON2V</HostId></Error>"
2015-01-29T10:46:59.546584+00:00 app[web.1]: :headers => {
2015-01-29T10:46:59.546586+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:46:59.546587+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:46:59.546589+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:46:58 GMT"
2015-01-29T10:46:59.546591+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:46:59.546593+00:00 app[web.1]: "x-amz-id-2" => "QDnWZ627/2/Wuf7z4nuQnS/u+ysezUG/o2IqDnO9hgAJBJF+H3h4uexFerBeON2V"
2015-01-29T10:46:59.546594+00:00 app[web.1]: "x-amz-request-id" => "6B6A73213C176F40"
2015-01-29T10:46:59.546595+00:00 app[web.1]: }
2015-01-29T10:46:59.546597+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:46:59.546598+00:00 app[web.1]: :local_port => 47100
2015-01-29T10:46:59.546601+00:00 app[web.1]: :remote_ip => "54.231.164.162"
2015-01-29T10:46:59.546600+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:46:59.546603+00:00 app[web.1]: :status => 403
2015-01-29T10:46:59.546604+00:00 app[web.1]: ):
2015-01-29T10:46:59.546606+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:46:59.546607+00:00 app[web.1]:
2015-01-29T10:46:59.546608+00:00 app[web.1]:
2015-01-29T10:46:59.544420+00:00 app[web.1]: Completed 500 Internal Server Error in 1951ms
2015-01-29T10:47:51.464274+00:00 app[web.1]: Started POST "/microposts" for 76.102.7.62 at 2015-01-29 10:47:51 +0000
2015-01-29T10:47:51.468398+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2015-01-29T10:47:51.473171+00:00 app[web.1]: User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 101]]
2015-01-29T10:47:51.468507+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"p60LlipkvgDwLSAR8oJq+efj9yM0jYixbkwxWxN2v3sojEQFzbMhTVio4pXOwZehVpGQYfgYdnKgHRQomE/txg==", "micropost"=>{"content"=>"Sup", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007f77ae6c1358 #tempfile=#<Tempfile:/tmp/RackMultipart20150129-9-6wmavu.jpg>, #original_filename="10582291_709123052488481_30008247_n.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"10582291_709123052488481_30008247_n.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2015-01-29T10:47:51.786456+00:00 app[web.1]: (1.4ms) BEGIN
2015-01-29T10:47:51.794299+00:00 app[web.1]: SQL (2.0ms) INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["content", "Sup"], ["picture", "10582291_709123052488481_30008247_n.jpg"], ["user_id", 101], ["created_at", "2015-01-29 10:47:51.788551"], ["updated_at", "2015-01-29 10:47:51.788551"]]
2015-01-29T10:47:53.555368+00:00 heroku[router]: at=info method=POST path="/microposts" host=mysterious-oasis-7816.herokuapp.com request_id=86847ddb-74ec-4800-a18f-a07f2431cef9 fwd="76.102.7.62" dyno=web.1 connect=1ms service=2197ms status=500 bytes=1786
2015-01-29T10:47:53.550620+00:00 app[web.1]: (1.3ms) ROLLBACK
2015-01-29T10:47:53.554579+00:00 app[web.1]:
2015-01-29T10:47:53.554582+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-01-29T10:47:53.554584+00:00 app[web.1]: excon.error.response
2015-01-29T10:47:53.554587+00:00 app[web.1]: :headers => {
2015-01-29T10:47:53.554586+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>6A39B8D8600F9D09</RequestId><HostId>cRac47ERlbGbSfrsTNt/fF+zt5CvM7Io8HZXU5A27l207MleOMCsGIRdmElP0Kk4</HostId></Error>"
2015-01-29T10:47:53.554589+00:00 app[web.1]: "Connection" => "close"
2015-01-29T10:47:53.554590+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-01-29T10:47:53.554593+00:00 app[web.1]: "Server" => "AmazonS3"
2015-01-29T10:47:53.554592+00:00 app[web.1]: "Date" => "Thu, 29 Jan 2015 10:47:53 GMT"
2015-01-29T10:47:53.554595+00:00 app[web.1]: "x-amz-id-2" => "cRac47ERlbGbSfrsTNt/fF+zt5CvM7Io8HZXU5A27l207MleOMCsGIRdmElP0Kk4"
2015-01-29T10:47:53.554612+00:00 app[web.1]: "x-amz-request-id" => "6A39B8D8600F9D09"
2015-01-29T10:47:53.554613+00:00 app[web.1]: }
2015-01-29T10:47:53.554619+00:00 app[web.1]: :remote_ip => "54.231.165.74"
2015-01-29T10:47:53.554620+00:00 app[web.1]: :status => 403
2015-01-29T10:47:53.554623+00:00 app[web.1]: app/controllers/microposts_controller.rb:7:in `create'
2015-01-29T10:47:53.554622+00:00 app[web.1]: ):
2015-01-29T10:47:53.554615+00:00 app[web.1]: :local_address => "172.17.38.98"
2015-01-29T10:47:53.554616+00:00 app[web.1]: :local_port => 40757
2015-01-29T10:47:53.554618+00:00 app[web.1]: :reason_phrase => "Forbidden"
2015-01-29T10:47:53.554625+00:00 app[web.1]:
2015-01-29T10:47:53.554626+00:00 app[web.1]:
2015-01-29T10:47:53.552507+00:00 app[web.1]: Completed 500 Internal Server Error in 2084ms
Please help :(
I had a similar problem, it was a matter of formatting the url differently depending on the region you create your bucket in.
You can sometimes use this:
https://s3-us-west-2.amazonaws.com/
and some times you have to use this:
https://bucket-name.s3-us-west-2.amazonaws.com/
I do not know which format you are using, but try the other one :)
For more info on the urls to access diffrent regions look at this:
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
Thanks for the help guys, I figured it out. It turns out it was something really silly, I didn't set the allowed users to registered users.