acorn-io / mongodb-atlas

0 stars 2 forks source link

Error messages seen in logs when mongodb-atlas service fails is not shown in App's Messages field. #8

Closed sangee2004 closed 11 months ago

sangee2004 commented 11 months ago

Steps to reproduce the problem:

  1. Deploy mongodb-atlas service with commit id cc9d6c88ae19 with some invalid parameter like invalid provider - aws in this case: acorn run --update -n hello1 . --dbName test1 --dbUser testuser --provider aws --region US_WEST_2
 % acorn apps  hello1   
NAME      IMAGE          COMMIT         CREATED   ENDPOINTS   MESSAGE
hello1    f74c0d4a9695   cc9d6c88ae19   56s ago               (job: create-cluster): restarting job, previous 2 attempts failed to complete, Error: Exit Code 1; (service: atlas): pending[update requested]

% acorn logs -f hello1 
create-cluster-cfhhg.create-cluster: -> [create.sh]
create-cluster-cfhhg.create-cluster: -> cluster mytestcluster does not exist
create-cluster-cfhhg.create-cluster: -> about to create cluster mytestcluster of type M0 in aws / US_WEST_2
create-cluster-cfhhg.create-cluster: Error: https://cloud.mongodb.com/api/atlas/v2/groups/6577a591314b6320b1772ab8/clusters POST: HTTP 400 Bad Request (Error code: "INVALID_ENUM_VALUE") Detail: An invalid enumeration value aws was specified. Reason: Bad Request. Params: [aws]
create-cluster-cfhhg.create-cluster: 
create-cluster-c45dp.create-cluster: -> [create.sh]
create-cluster-c45dp.create-cluster: -> cluster mytestcluster does not exist
create-cluster-c45dp.create-cluster: -> about to create cluster mytestcluster of type M0 in aws / US_WEST_2
create-cluster-c45dp.create-cluster: Error: https://cloud.mongodb.com/api/atlas/v2/groups/6577a591314b6320b1772ab8/clusters POST: HTTP 400 Bad Request (Error code: "INVALID_ENUM_VALUE") Detail: An invalid enumeration value aws was specified. Reason: Bad Request. Params: [aws]
create-cluster-c45dp.create-cluster: 
^CERRO[0002] error reading websocket: read tcp 192.168.1.69:51195->18.116.209.145:443: use of closed network connection 

Expected Behavior: Messages field for APP should show the error messages relating - POST: HTTP 400 Bad Request (Error code: "INVALID_ENUM_VALUE") Detail: An invalid enumeration value aws was specified. Reason: Bad Request. Params: [aws] that is seen in the logs.

cloudnautique commented 11 months ago

Will look into this, but everything needs to be uppercase I believe. I'll see if we can get away with just doing a toUpper on the arg.

cloudnautique commented 11 months ago

These should both be handled now. Keep in mind, we are writing to the termination-log like cdk-runner so it doesn't always show up super quick.

sangee2004 commented 11 months ago

Error messages seen in logs are now shown in the Message status.

acorn apps
NAME        IMAGE          COMMIT         CREATED   ENDPOINTS   MESSAGE
mytestnew   6b838711978e   6f25ec5470da   65s ago               (job: create-cluster): restarting job, previous 1 attempts failed to complete, Error: Exit Code 1: Error: https://cloud.mongodb.com/api/atlas/v2/groups/6578be257996670d69bcf864/clusters POST: HTTP 400 Bad Request (Error code: "CANNOT_CREATE_FREE_CLUSTER_VIA_PUBLIC_API") Detail: Cannot create a cluster with instance size M0 via the public api: This project already has another free cluster. Reason: Bad Request. Params: [This project already has another free cluster]
; (service: atlas): pending; (secret: admin): waiting: [job has no output]; (secret: user): waiting: [job has no output]