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

botocore.exceptions.ParamValidationError: #1256

Closed
amits121 opened this issue Sep 9, 2017 · 7 comments
Closed

botocore.exceptions.ParamValidationError: #1256

amits121 opened this issue Sep 9, 2017 · 7 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. question

Comments

@amits121
Copy link

amits121 commented Sep 9, 2017

I am getting the following error;

botocore.exceptions.ParamValidationError: Parameter validation failed:

Invalid type for parameter ContentType, value: None, type: , valid types:

@JordonPhillips JordonPhillips added closing-soon This issue will automatically close in 4 days unless further comments are made. question labels Sep 11, 2017
@JordonPhillips
Copy link
Contributor

JordonPhillips commented Sep 11, 2017

What operation were you calling? Could you provide some debug logs and a code snippet?

@jamesls
Copy link
Member

jamesls commented Sep 18, 2017

Closing due to inactivity.

@jamesls jamesls closed this as completed Sep 18, 2017
@bxm156
Copy link

bxm156 commented Oct 14, 2017

I am getting this as well, calling PUT. My initial suspicion is that its an issue caused by another package, not a boto3 issue direclty. Here is the full stack trace:

...
File "/var/task/storages/backends/s3boto3.py", line 436, in _save
  obj.upload_fileobj(content, ExtraArgs=put_parameters)
  File "/var/task/boto3/s3/inject.py", line 431, in upload_fileobj
  File "/var/task/storages/backends/s3boto3.py", line 451, in _save_content           obj.upload_fileobj(content, ExtraArgs=put_parameters)
  File "/var/task/boto3/s3/inject.py", line 513, in object_upload_fileobj             ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)                              File "/var/task/boto3/s3/inject.py", line 431, in upload_fileobj
  return future.result()
  File "/var/task/s3transfer/futures.py", line 73, in result
  return self._coordinator.result()                                                   File "/var/task/s3transfer/futures.py", line 233, in result                         raise self._exception
  File "/var/task/s3transfer/tasks.py", line 126, in __call__
  return self._execute_main(kwargs)
  File "/var/task/s3transfer/tasks.py", line 150, in _execute_main
  return_value = self._main(**kwargs)
  File "/var/task/s3transfer/upload.py", line 679, in _main
  client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
  File "/var/task/botocore/client.py", line 253, in _api_call
  return self._make_api_call(operation_name, kwargs)
  File "/var/task/botocore/client.py", line 531, in _make_api_call
  api_params, operation_model, context=request_context)
  File "/var/task/botocore/client.py", line 586, in _convert_to_request_dict
  api_params, operation_model)
  File "/var/task/botocore/validate.py", line 291, in serialize_to_request
  raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter ContentType, value: None, type: <class 'NoneType'>, valid types: <class 'str'>

Using:
boto3==1.4.5
botocore==1.5.40
s3transfer==0.1.10

Python 3.6

@jrief
Copy link

jrief commented Nov 24, 2017

I'm getting this error as well, using
boto3==1.4.8
botocore==1.8.1
s3transfer==0.1.11

@JordonPhillips can't provide a code snippet here, because it's a call from a 3rd party app, aka django-filer, deeply inside a Django admin's object save.

  (... same as above ...)
  File ".../python3.6/site-packages/botocore/validate.py", line 291, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter ContentType, value: None, type: <class 'NoneType'>, valid types: <class 'str'>

The trace stack is identical with that provided by @bxm156

@bxm156
Copy link

bxm156 commented Nov 24, 2017 via email

@bxm156
Copy link

bxm156 commented Nov 26, 2017

@jrief

The issue is that django-storages is calling boto with an empty Content-Type, which is not allowed. This is perhaps due to a bug in either filer or django-storages. The django File object for some reason has a content-type of "None" I don't know why, but I found an improvement to the file type detection that could be made in django-storages.

jschneier/django-storages#407

@jrief
Copy link

jrief commented Nov 27, 2017

OK, thanks for your efforts.
So, since that PR isn't merged yet, I'll try with a private fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. question
Projects
None yet
Development

No branches or pull requests

5 participants