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

create new site Server Error 500 hurrah still created #663

Closed
neilh10 opened this issue Jun 30, 2023 · 8 comments
Closed

create new site Server Error 500 hurrah still created #663

neilh10 opened this issue Jun 30, 2023 · 8 comments

Comments

@neilh10
Copy link

neilh10 commented Jun 30, 2023

On attempting to create new site I get Server Error 500

image

however they are created
image

@neilh10
Copy link
Author

neilh10 commented Jul 10, 2023

I guess an anomaly - all been working since then.

@neilh10 neilh10 closed this as completed Jul 10, 2023
@neilh10
Copy link
Author

neilh10 commented Aug 1, 2023

Happened again for someone else - seems like its not an anomaly.
https://www.envirodiy.org/topic/registering-a-new-site-on-mmw/

@neilh10 neilh10 reopened this Aug 1, 2023
@ScottEnsign
Copy link
Collaborator

Indeed, this is a recurring issue. @ptomasula examined this issue in May 2023 for another user and was not able to offer a resolution.

@ptomasula
Copy link
Member

I have successfully recreated this issue and it appears related to #668 (which I just opened). If you do not select the Notify me if site stops receiving sensor data option, I can get the form to submit without a 500 error. I suspect that fixing and closing #668 will resolve this issue as well. In the interim you can create a site by not checking that option.

@ptomasula
Copy link
Member

Our other user was still reporting issues even after I closed #668. Further investigation revealed this was related to some legacy data integrity issues in the affiliations table. Efforts were previously undertaken prior to release 0.15 to address these data issues, but four additional accounts where not successfully matched during that process. I added affiliation records for these accounts. Waiting for confirmation this addresses the problem for them before closing this issue.

@ptomasula
Copy link
Member

We did successfully resolve this issue for the other user and determined it was related to missing records in the affiliations table. This resolves the immediate issue and will allow users to create sites again without issue. However, a review of the relevant code revealed that there is an remaining issue that can result in sites being partially created, with site information being created in one of the two relevant data tables. When the right conditions are met, those records will persist even with site generation failure. I recommend that the following refactoring be undertaken when time permits.

  • Refactor failure pathways for site creation to delete records in the first table (samplingfeatures) when site creation fails (i.e. restore database atomicity).
  • Return a more specific error message and different error code (400) when site creation failed due to conflicting site_code/samplingfeature_code so that user is better informed of why site generation failed.
  • Update user interface to display error message instead of relying on default error page.

@neilh10
Copy link
Author

neilh10 commented Aug 15, 2023

@ptomasula thanks very much for the info.
Looking at error codes, as defined by https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
500 Internal Server Error
A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.

400 Bad Request -
The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing).

From the "hydrologic user" using MMW screens to query a nodes data, it should just work by the options allowed on the screen.
From an integrated programming nexus - there is the MMW screens that construct a POST, that is then sent to the backend server. In proposing a 400 is returned from the server (a step up from the 500), its actually an "internal" debug message that the HTML interface page constructing the POST, has not been constructed to the rules the backend server processes the request.

So is this a messy turd, with the issue being there isn't a defined RESTful interface between the front end MMW html and the back end server?.
I haven't seen any descriptions of the back end server POST processing - and maybe I wouldn't want to - hopefully it just works.

@aufdenkampe
Copy link
Member

The main issue here is resolved.

These side issues will be tracked under the following, which we plan to address with our v0.18 Milestone:

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

4 participants