nonprofittechy / docassemble-ssioverpaymentwaiver

Request for Waiver of SSI Overpayment
https://docassemble.org
MIT License
2 stars 6 forks source link

Prod error: JSONDecodeError #105

Open BryceStevenWilley opened 1 year ago

BryceStevenWilley commented 1 year ago
There was an error in the CourtFormsOnline application.

The error message was:

JSONDecodeError: 

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Traceback (most recent call last):
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/webapp/server.py", line 8122, in index
    interview.assemble(user_dict, interview_status, old_user_dict, force_question=special_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 8642, in assemble
    raise the_error
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 8429, in assemble
    question_result = self.askfor(missingVariable, user_dict, old_user_dict, interview_status, seeking=interview_status.seeking, follow_mc=follow_mc, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9252, in askfor
    question_result = self.askfor(newMissingVariable, user_dict, old_user_dict, interview_status, variable_stack=variable_stack, questions_tried=questions_tried, seeking=seeking, follow_mc=follow_mc, recursion_depth=recursion_depth, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9252, in askfor
    question_result = self.askfor(newMissingVariable, user_dict, old_user_dict, interview_status, variable_stack=variable_stack, questions_tried=questions_tried, seeking=seeking, follow_mc=follow_mc, recursion_depth=recursion_depth, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9137, in askfor
    exec_with_trap(question, user_dict)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9754, in exec_with_trap
    exec(the_question.compute, the_dict)
  File "", line 1, in 
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 38, in load_offices
    results = self.searcher.nearest_offices(address, distance=distance)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 133, in nearest_offices
    return self.nearest_offices_by_lat_lng(address.location.latitude,address.location.longitude, distance=distance)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 123, in nearest_offices_by_lat_lng
    jdata = r.json()
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The referer URL was https://apps.suffolklitlab.org/run/ssioverpayment/

Traceback (most recent call last):
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/webapp/server.py", line 8122, in index
    interview.assemble(user_dict, interview_status, old_user_dict, force_question=special_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 8642, in assemble
    raise the_error
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 8429, in assemble
    question_result = self.askfor(missingVariable, user_dict, old_user_dict, interview_status, seeking=interview_status.seeking, follow_mc=follow_mc, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9252, in askfor
    question_result = self.askfor(newMissingVariable, user_dict, old_user_dict, interview_status, variable_stack=variable_stack, questions_tried=questions_tried, seeking=seeking, follow_mc=follow_mc, recursion_depth=recursion_depth, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9252, in askfor
    question_result = self.askfor(newMissingVariable, user_dict, old_user_dict, interview_status, variable_stack=variable_stack, questions_tried=questions_tried, seeking=seeking, follow_mc=follow_mc, recursion_depth=recursion_depth, seeking_question=seeking_question)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9137, in askfor
    exec_with_trap(question, user_dict)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9754, in exec_with_trap
    exec(the_question.compute, the_dict)
  File "", line 1, in 
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 38, in load_offices
    results = self.searcher.nearest_offices(address, distance=distance)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 133, in nearest_offices
    return self.nearest_offices_by_lat_lng(address.location.latitude,address.location.longitude, distance=distance)
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/ssioverpaymentwaiver/ssa.py", line 123, in nearest_offices_by_lat_lng
    jdata = r.json()
  File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The external hostname was apps.suffolklitlab.org
BryceStevenWilley commented 12 months ago

This has been happening a lot more recently.

The URL in question that doesn't seem to be loading correctly is https://github.com/nonprofittechy/docassemble-ssioverpaymentwaiver/blob/803dc3bb3d8e6802bbfdc093dd4b7be3e6e70d24/docassemble/ssioverpaymentwaiver/ssa.py#L75C18-L75C120. Visiting it directly gives a 404.

I found the original Stackoverflow question that led you to this code (i.e. the only place I can search for and find this specific URL).

From the SSA's current API page it looks like the new URL is https://services6.arcgis.com/zFiipv75rloRP5N4/arcgis/rest/services/SSA_Field_Office_Information/FeatureServer. I'm not sure what to look for there to make sure that the information is the same, so I'll have to leave it at that.