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

Required parameter name not set #255

Closed
Vesli opened this issue Jan 25, 2017 · 2 comments
Closed

Required parameter name not set #255

Vesli opened this issue Jan 25, 2017 · 2 comments

Comments

@Vesli
Copy link

Vesli commented Jan 25, 2017

ValueError at /admin/filer/folder/1/delete/
Required parameter name not set
Request Method: POST
Request URL: http://project.com/admin/filer/folder/1/delete/?_pick=file&_popup=1
Django Version: 1.9.12
Exception Type: ValueError
Exception Value:
Required parameter name not set
Exception Location: /var/www/webapps/lib/python3.4/site-packages/boto3/resources/base.py in init, line 119
Python Executable: /var/www/webapps/bin/python3

Since I change where my medias and statics file have to be store (meaning now it's in a AWS S3) I can't upload images anymore through the django-filer plugin.
I thought first it was coming from their plugin but the stack trace point to boto3.
I'm using:
django==1.9.12 && django-storages==1.5.2.

Before posting the report, a collectstatic copies without problems my files to s3. Meaning that it seems to be properly configured, with the classical:
`AWS_STORAGE_BUCKET_NAME = os.environ.get('DJANGO_AWS_STORAGE_BUCKET_NAME')
AWS_ACCESS_KEY_ID = os.environ.get('DJANGO_AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('DJANGO_AWS_SECRET_ACCESS_KEY')

AWS_S3_CUSTOM_DOMAIN = os.environ.get('DJANGO_AWS_STORAGE_BUCKET_NAME', 'bucketname.s3.amazonaws.com')

STATICFILES_LOCATION = 'static'
STATICFILES_STORAGE = 'project.storage.StaticStorage'
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

MEDIAFILES_LOCATION = 'media'
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
DEFAULT_FILE_STORAGE = 'project.storage.MediaStorage' `

Do you have any clue about what the problem could be? I'm completely hopeless about solving it.

Here the stack trace:

[2017-01-25 13:55:07 +0000] [6743] [DEBUG] POST /admin/filer/clipboard/operations/upload/1/
Internal Server Error: /admin/filer/clipboard/operations/upload/1/
Traceback (most recent call last):
File "/var/www/webapps/lib/python3.4/site-packages/filer/models/filemodels.py", line 194, in save
super(File, self).save(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/polymorphic/models.py", line 90, in save
return super(PolymorphicModel, self).save(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/base.py", line 708, in save
force_update=force_update, update_fields=update_fields)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/base.py", line 735, in save_base
self._save_parents(cls, using, update_fields)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/base.py", line 760, in _save_parents
self._save_table(cls=parent, using=using, update_fields=update_fields)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/base.py", line 820, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/base.py", line 859, in _do_insert
using=using, raw=raw)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/query.py", line 1039, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 1059, in execute_sql
for sql, params in self.as_sql():
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 1019, in as_sql
for obj in self.query.objs
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 1019, in
for obj in self.query.objs
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 1018, in
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 968, in pre_save_val
return field.pre_save(obj, add=True)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/fields/files.py", line 311, in pre_save
file.save(file.name, file, save=False)
File "/var/www/webapps/lib/python3.4/site-packages/filer/fields/multistorage_file.py", line 122, in save
super(MultiStorageFieldFile, self).save(name, content, save)
File "/var/www/webapps/lib/python3.4/site-packages/easy_thumbnails/files.py", line 670, in save
super(ThumbnailerFieldFile, self).save(name, content, *args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/django/db/models/fields/files.py", line 93, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/var/www/webapps/lib/python3.4/site-packages/django/core/files/storage.py", line 63, in save
name = self._save(name, content)
File "/var/www/webapps/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 448, in _save
obj = self.bucket.Object(encoded_name)
File "/var/www/webapps/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 306, in bucket
self._bucket = self._get_or_create_bucket(self.bucket_name)
File "/var/www/webapps/lib/python3.4/site-packages/storages/backends/s3boto3.py", line 338, in _get_or_create_bucket
bucket = self.connection.Bucket(name)
File "/var/www/webapps/lib/python3.4/site-packages/boto3/resources/factory.py", line 474, in create_resource
client=self.meta.client)(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/boto3/resources/base.py", line 119, in init
'Required parameter {0} not set'.format(identifier))
ValueError: Required parameter name not set

@jschneier
Copy link
Owner

The only way I can reproduce this is to pass None into connection.Bucket, I don't think that this library is the issue.

@sfogle
Copy link

sfogle commented Mar 10, 2017

So I had a similar problem when I was trying to run collectstatic in my local environment. The code was looking for AWS_STORAGE_BUCKET_NAME to be set ('name' variable) in my environment variables, which it was not in my local environment. But I was supposedly in a DEBUG mode with my debug/local environment variables set, so it should have never been getting to this code in the first place!

It turned out that my local environment and the env variables were just messed up, and I had sort of a half-debug env and a half-prod env on my local. So maybe make sure you definitely have the environment variables set correctly for the environment you think you are using so it doesn't get into a weird state where it is looking for AWS variables that aren't set because you mean for them not to be. Hope this helps someone.

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