Uploaded image for project: 'Atlas Module'
  1. Atlas Module
  2. ATLAS-185

Deleting or updating an invalid marker crashes server

    Details

    • Type: Bug
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      If a user attempts to delete or update a non-existent marker, the Atlas server crashes. At the moment, this can be done easily by creating a new marker and then clicking on the delete icon or update link of the newly created marker.

      Recreating the error

      Use these steps to see the actual error.

      1. Start up local copy of atlas
      2. Browse to localhost:3000 and authenticate as testadmin
      3. Turn on with developer tools and switch to the Network tab
      4. Reload the page as testadmin
      5. Find the request to /markers in the developers tool and copy the value of the cookie from its request header
      6. Open a terminal window and follow the server logs, e.g.:
        docker -logs -f openmrs-contrib-atlas_atlas_1 
      7. From a separate terminal window issue the command
        curl --cookie "value of cookie here" -X DELETE localhost:3000/marker/0
      8. Note that the server crashes with this error:
        /node_modules/mysql/lib/protocol/Parser.js:80
                throw err; // Rethrow non-MySQL errors
                ^TypeError: Cannot read property 'created_by' of undefined
            at Query._callback (/routes/markers.js:255:32)
            at Query.Sequence.end (/node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24)
            at Query._handleFinalResultPacket (/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
            at Query.EofPacket (/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
            at Protocol._parsePacket (/node_modules/mysql/lib/protocol/Protocol.js:279:23)
            at Parser.write (/node_modules/mysql/lib/protocol/Parser.js:76:12)
            at Protocol.write (/node_modules/mysql/lib/protocol/Protocol.js:39:16)
            at Socket.<anonymous> (/node_modules/mysql/lib/Connection.js:103:28)
            at emitOne (events.js:116:13)
            at Socket.emit (events.js:211:7)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              burke Burke Mamlin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: