Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carrierwave 500s with "TypeError (no implicit conversion of nil into String)" when not on Heroku #43

Open
rick opened this issue Nov 15, 2013 · 9 comments

Comments

@rick
Copy link

rick commented Nov 15, 2013

I have a patch for this over in https://github.com/rick/balder/pull/1, specifically https://github.com/rick/balder/commit/81af9e7eedef9cf5a1d676213f888d6cfee40fa7
but I'm not clear on what the various concerns are (and whether this will break something for other folks).

I was seeing these sort of errors consistently:

TypeError (no implicit conversion of nil into String):
  app/controllers/photos_controller.rb:80:in `create'
  app/middleware/flash_session_cookie_middleware.rb:16:in `call'

The cache_dir method, which carrierwave seems to rely on, is only defined on Heroku + S3 configurations. It might actually need to be widened to be defined on all configurations, but I'm at least relying on S3 myself, so not sure.

@espen
Copy link
Owner

espen commented Nov 15, 2013

What server are you using? I would assume that the tmp directory would be writable otherwise (Heroku is sortof read-only).

@rick
Copy link
Author

rick commented Nov 15, 2013

I'm on a digitalocean VPS for this installation, nginx + unicorn. The problem doesn't appear to be one of whether the temp directory is writeable, but rather one of the call to cache_dir from inside carrierwave blows up because there's no implementation of cache_dir in scope when using S3 but not using Heroku.

Would it be more appropriate to delegate to some other default in the non-Heroku case? I looked back at the history of the file and couldn't infer what the intent was when I tracked down the problem.

@coneybeare
Copy link

I am seeing this problem problem when uploading on a private server as well as localhost.

Completed 500 Internal Server Error in 952ms

TypeError (can't convert nil into String):
  app/controllers/photos_controller.rb:82:in `create'
  app/middleware/flash_session_cookie_middleware.rb:16:in `call'

@espen
Copy link
Owner

espen commented Nov 26, 2013

And it works when setting the tmp dir? I'm a bit confused with the error message if the problem is not being able to store to disk.

@coneybeare
Copy link

I am not sure that that is the problem, the error message is pretty vague. I am using s3 and not heroku, so maybe the cache_dir thing is the problem, maybe not. Is there anything you want me to experiment with to help debug?

@espen
Copy link
Owner

espen commented Nov 26, 2013

A full stack trace would help. Try changing this and see if that helps. https://github.com/rick/balder/commit/81af9e7eedef9cf5a1d676213f888d6cfee40fa7

@coneybeare
Copy link

Not necessary. I just commented out the cache_dir method and it worked. So the problem is that you are returning false from the cache_dir method in file_uploader.rb when not using heroku instead of calling super or the default it expects (I think).

@coneybeare
Copy link

Hm, spoke too soon. Worked locally, but not on the remote server.

@coneybeare
Copy link

Sorry for the smap, twas a caching issue. This fix works for me both locally and on my remote non-heroku server with s3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants