Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-8983

Init endpoint will return a 500 if init request are sent close together for new device

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • None
    • None

      Steps to reproduce

      happens if the init endpoint is hit multiple time on a app on a new device

      • create an ionic app
      • import axios and add the following code to your main.js
      import axios from "axios";
      payload = {
      	"appId":"io.ionic.starter",
              "deviceId":"e71b7790-5537-11e9-88a1-85ea65c9f61e",
              "deviceType":"android",
              "deviceVersion":"8.0.0",
              "version":"0.0.1"
      }
      
      axios.post("http://10.0.2.2:3000/api/init", payload)
      axios.post("http://10.0.2.2:3000/api/init", payload)
      

      add the app to the app table on the database
      you will need uuid for the id (https://www.uuidgenerator.net/)
      and the appId which is io.ionic.starter

      start the go server
      ionic serve

      Issue

      Ionic app will return a 500 on the second post

      Server returns an error on second request

      time="2019-04-02T12:38:20+01:00" level=info client_ip="127.0.0.1:39024" method=POST path=/api/init response_time=259ns
      time="2019-04-02T12:38:20+01:00" level=error msg="sql: no rows in result set"
      time="2019-04-02T12:38:20+01:00" level=info client_ip="127.0.0.1:39026" method=POST path=/api/init response_time=219ns
      time="2019-04-02T12:38:20+01:00" level=error msg="sql: no rows in result set"
      time="2019-04-02T12:38:20+01:00" level=error msg="pq: duplicate key value violates unique constraint \"version_app_id_version_key\""
      time="2019-04-02T12:38:20+01:00" level=error msg="sql: no rows in result set"
      
      

            Unassigned Unassigned
            aucunnin@redhat.com Austin Cunningham
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: