kobotoolbox / kobo-install

A command-line installer for setting up and running KoboToolbox on a remote server or local computer, using kobo-docker.
173 stars 161 forks source link

Error - No JSON object could be decoded #84

Closed dhakim closed 4 years ago

dhakim commented 4 years ago

Hello,

I am facing an issue with form deployment. I have installed Kobo Toolbox on my own server around 6 months ago which was working fine but after the recent update, I am unable to deploy any form. I posted this question on the community forums and have read different topics on the same error but couldn't resolve this issue. I asked the similar question here https://community.kobotoolbox.org/t/error-unable-to-deploy-no-json-object-could-be-decoded/8888/8.

After some investigation in logs, I found below traceback in kobocat logs

ERROR 2020-04-24 07:02:17,388 base 229 140446137800512 Internal Server Error: /api/v1/forms
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/viewsets.py", line 87, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "./onadata/apps/api/viewsets/xform_viewset.py", line 740, in create
    survey = utils.publish_xlsform(request, owner)
  File "./onadata/apps/api/tools.py", line 266, in publish_xlsform
    return publish_form(set_form)
  File "./onadata/libs/utils/logger_tools.py", line 455, in publish_form
    return callback()
  File "./onadata/apps/api/tools.py", line 264, in set_form
    return form.publish(user)
  File "./onadata/apps/main/forms.py", line 326, in publish
    return publish_xls_form(cleaned_xls_file, user, id_string)
  File "./onadata/libs/utils/logger_tools.py", line 515, in publish_xls_form
    xls=xls_file
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 348, in create
    obj.save(force_insert=True, using=self.db)
  File "./onadata/apps/viewer/models/data_dictionary.py", line 159, in save
    super(DataDictionary, self).save(*args, **kwargs)
  File "./onadata/apps/logger/models/xform.py", line 211, in save
    super(XForm, self).save(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 734, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 762, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 846, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 885, in _do_insert
    using=using, raw=raw)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 920, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 973, in execute_sql
    for sql, params in self.as_sql():
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 931, in as_sql
    for obj in self.query.objs
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/files.py", line 314, in pre_save
    file.save(file.name, file, save=False)
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py", line 63, in save
    name = self._save(name, content)
  File "/srv/pip_editable_packages/django-storages/storages/backends/s3boto.py", line 409, in _save
    key = self.bucket.get_key(encoded_name)
  File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 193, in get_key
    key, resp = self._get_key_internal(key_name, headers, query_args_l)
  File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 232, in _get_key_internal
    response.status, response.reason, '')
S3ResponseError: S3ResponseError: 400 Bad Request

{address space usage: 915894272 bytes/873MB} {rss usage: 117383168 bytes/111MB} [pid: 229|app: 0|req: 17/17] 172.22.0.3 () {38 vars in 656 bytes} [Fri Apr 24 07:02:16 2020] POST /api/v1/forms => generated 4269 bytes in 443 msecs (HTTP/1.1 500) 4 headers in 156 bytes (2 switches on core 0)

Its seems like kobo toolbox is not able to connect with my S3 bucket using the credentials I provided but the same credentials I checked are working on aws cli.

noliveleger commented 4 years ago

I'm closing this issue in favor of this thread on the community forum.