drusepth / Indent

Indent is a set of tools for writers, game designers, and roleplayers to create magnificent universes – and everything within them.
http://indentapp.com
1 stars 1 forks source link

Location map upload/showing is temporarily disabled #416

Open drusepth opened 9 years ago

drusepth commented 9 years ago

I had to disable maps on locations temporarily during the release because location.map was failing with :bucket not specified errors. It might be as not sourcing S3 credentials properly or just needing to tweak gem syntax with an upgraded rails/gem/something, but it was like 3am so I just disabled it for a smooth release and will hopefully fix ASAP.

Cantido commented 9 years ago

When running the server locally, and I create a location just a name and a universe, I get an error that I don't have the aws-sdk gem. However, in 815dd115473882c120d254a2f0f0ccf4659dcc53, I wrote a Capybara test to re-create this, but the test passes.

It looks like when RAILS_ENV=development, I see this failure, but in RAILS_ENV=test, I do not. Do you know why this could be? The Gemfile only includes aws-sdk in the :production group.

drusepth commented 9 years ago

Hrm. I can't seem to replicate this locally, which potentially points to some kind of environment issue, but I can still seed (after uncommenting the seeds.rb lines) and create locations just fine locally, when running RAILS_ENV=development, test, and production.

If I could get an actual error message to look at it might be easier to debug. Is it giving a line number in the stack trace of where the aws-sdk gem is trying to be used?

Cantido commented 9 years ago

In the location controller at a call to Location.save. Tomorrow evening I'll bring the error up and post all the information here.

On Mon, Mar 23, 2015, 1:07 AM Andrew Brown notifications@github.com wrote:

Hrm. I can't seem to replicate this locally, which potentially points to some kind of environment issue, but I can still seed (after uncommenting the seeds.rb lines) and create locations just fine locally, when running RAILS_ENV=development, test, and protection.

If I could get an actual error message to look at it might be easier to debug. Is it giving a line number in the stack trace of where the aws-sdk gem is trying to be used?

— Reply to this email directly or view it on GitHub https://github.com/drusepth/Indent/issues/416#issuecomment-84826290.

drusepth commented 9 years ago

Got it by tailing production logs. Looks like the map and map_content_type validations were failing on existing locations with a map content type of "" (and, I assume for similar reasons in some environments otherwise). I'm not sure how they got into this state or if paperclip even looks at the content type, but uploads are a janky mess that need cleaned up eventually. :/

Commenting out the validations seems to make locations work a-ok. So maybe we need to explicitly allow "" for content_type (or specify one in our seed data?) and/or allow nil for map/map_content_type? This looks to be the issue of #415

Cantido commented 9 years ago

I just wrote a Capybara test to upload an image, and the test passed. However, when I did the same steps on a local server, it failed for me, with the message missing required :bucket option and the trace is pointing to paperclip not having an s3 bucket name. Am I seeing a different issue?

Cantido commented 9 years ago

Also, to reply to the empty map content issue: in my stack trace, the map file had a content type:

"map"=>#<ActionDispatch::Http::UploadedFile:0x5407650 @tempfile=#<Tempfile:C:/Users/Bobby/AppData/Local/Temp/RackMultipart20150323-8176-vq0qhq>,
 @original_filename="2013-11-03 12.27.20.jpg",
 @content_type="image/jpeg",
 @headers="Content-Disposition: form-data; name=\"location[map]\"; filename=\"2013-11-03 12.27.20.jpg\"\r\nContent-Type: image/jpeg\r\n">
Cantido commented 9 years ago

The Locations controller rejects image uploads without a MIME type. Here is a test that verifies that:

https://github.com/drusepth/Indent/blob/master/test/controllers/locations_controller_test.rb#L75

Cantido commented 9 years ago

Oh, I just realized that the :bucket problem I was having was in your original description.

That does sound like the credentials are messed up, since I don't have them either.