BIDMCDigitalPsychiatry / LAMP-platform

The LAMP Platform (issues and documentation).
https://docs.lamp.digital/
Other
12 stars 10 forks source link

mindLAMP Dashboard Access is timedout by 504 error #755

Open jeydude1 opened 1 year ago

jeydude1 commented 1 year ago

Hi,

We are getting this below error from our domain, is there anything we need to do with LAMP Stack to fix this? user is not able to continue any of the activity because the request is blocked

image

image

avaidyam commented 1 year ago

Considering this is a 504 Gateway Timeout, the issue appears to potentially be on your server's side. Typically if the server or gateway are down, you'll also see CORS errors.

jeydude1 commented 1 year ago

Thanks working with API team, Unix team and F5 team.

jeydude1 commented 1 year ago

Hi Aditya,

We are still getting 504 Gateway Timeout error from two different API (Akana and Apigee) system

Here is the Request (POST Request to the main URL - / API.Query) getting timeout error, my API team wants to know why the content type needs to be application/json when the payload data passed is not JSON data format

curl -k --location 'https://EXTERNALAPISERVER/mlpapiservice/v1/' --header 'Content-Type: application/json' --header 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==' --data '"($studyList := $LAMP.Study.list('\''7vs81xf3w38dec5dsd64'\'');$unitySettings := $LAMP.Tag.get('\''7vs81xf3w38dec5dsd64'\'','\''to.unityhealth.psychiatry.enabled'\''); $filterAudioOut := function() { $ ~> |$|{}, ['\''audio'\'']| }; $list :={'\''unity_settings'\'': $LAMP.Tag.get('\''7vs81xf3w38dec5dsd64'\'','\''to.unityhealth.psychiatry.enabled'\''),'\''studies'\'':[$map($studyList,function($study){{'\''name'\'': $study.name,'\''id'\'':$study.id,'\''participants'\'':[$map($LAMP.Participant.list($study.id).id,function($id){{'\''name'\'': $LAMP.Tag.get($id,'\''lamp.name'\''), '\''unity_settings'\'' : $unitySettings ? $LAMP.Tag.get($id,'\''to.unityhealth.psychiatry.settings'\'') : null,'\''id'\'':$id, '\''study_id'\'' : $study.id, '\''study_name'\'': $study.name }})],'\''activities'\'':[$map($LAMP.Activity.list($study.id),function($activity){{'\''name'\'': $activity.name, '\''spec'\'': $activity.spec, '\''category'\'': $activity.category, '\''schedule'\'': $activity.schedule, '\''settings'\'': $filterAudioOut($activity.settings), '\''id'\'':$activity.id, '\''study_id'\'' : $study.id, '\''study_name'\'': $study.name}})],'\''sensors'\'':[$map($LAMP.Sensor.list($study.id),function($sensor){{'\''name'\'': $sensor.name,'\''id'\'':$sensor.id,'\''spec'\'': $sensor.spec,'\''study_id'\'': $study.id,'\''study_name'\'': $study.name}})]}})]})"'

ertjlane commented 1 year ago

Hello @jeydude1 That's actually that's a JSON string containing a LAMP query, please do not block this endpoint. In addition, I wonder if the query is taking too long and timing out? Can you check the logs for the server and gateway to confirm?

jeydude1 commented 1 year ago

Hi @ertjlane below data is the payload data, as you can see, this is not JSON, please try on your side and see.

"( ~> |$|{}, ['''audio''']| }; $list :={'''unity_settings''': $LAMP.Tag.get('''7vs81xf3w38dec5dsd64''','''to.unityhealth.psychiatry.enabled'''),'''studies''':[$map($studyList,function($study){{'''name''': $study.name,'''id''':$study.id,'''participants''':[$map($LAMP.Participant.list($study.id).id,function($id){{'''name''': $LAMP.Tag.get($id,'''lamp.name'''), '''unity_settings''' : $unitySettings ? $LAMP.Tag.get($id,'''to.unityhealth.psychiatry.settings''') : null,'''id''':$id, '''study_id''' : $study.id, '''study_name''': $study.name }})],'''activities''':[$map($LAMP.Activity.list($study.id),function($activity){{'''name''': $activity.name, '''spec''': $activity.spec, '''category''': $activity.category, '''schedule''': $activity.schedule, '''settings''': $filterAudioOut($activity.settings), '''id''':$activity.id, '''study_id''' : $study.id, '''study_name''': $study.name}})],'''sensors''':[$map($LAMP.Sensor.list($study.id),function($sensor){{'''name''': $sensor.name,'''id''':$sensor.id,'''spec''': $sensor.spec,'''study_id''': $study.id,'''study_name''': $study.name}})]}})]})"

Here is the output I am getting in the LAMP API Server while calling calling from External API system like Akana/Apigee:

2023-04-18T19:10:07.925535557Z -- LAMP.Study.list: 26.00 ms 2023-04-18T19:10:08.008544254Z -- LAMP.Tag.get: 81.00 ms 2023-04-18T19:10:08.076019793Z -- LAMP.Participant.list: 66.00 ms 2023-04-18T19:10:08.082031972Z -- LAMP.Activity.list: 69.00 ms 2023-04-18T19:10:08.090313732Z -- LAMP.Sensor.list: 76.00 ms 2023-04-18T19:10:08.136041359Z -- LAMP.Tag.get: 127.00 ms 2023-04-18T19:10:08.217212394Z -- LAMP.Tag.get: 141.00 ms 2023-04-18T19:10:08.358712715Z -- LAMP.Tag.get: 141.00 ms 2023-04-18T19:10:08.476662105Z -- LAMP.Tag.get: 117.00 ms 2023-04-18T19:10:08.518338837Z -- LAMP.Participant.list: 38.00 ms 2023-04-18T19:10:08.525745136Z -- LAMP.Activity.list: 46.00 ms 2023-04-18T19:10:08.529840941Z -- LAMP.Sensor.list: 50.00 ms 2023-04-18T19:10:08.669437656Z -- LAMP.Tag.get: 147.00 ms 2023-04-18T19:10:08.801054605Z -- LAMP.Tag.get: 133.00 ms 2023-04-18T19:10:08.801073195Z Query: 913.00 ms 2023-04-18T19:10:08.801081138Z POST / 200 - 913.647 ms

Our Apigee/Akana API team believes the request is timing out due to string data is passed but not JSON. I am still working with them to make sure request is not timing out.

avaidyam commented 1 year ago

@jeydude1 This endpoint should accept a JSON string containing a LAMP query (which is what you see). It may be passed in text to avoid escaping quotes and other characters. This API was added and has been used since 2020 so it's unlikely that timeouts are a result of text vs. JSON nature. Please make sure your gateway does not auto-timeout if no response is provided from the server.