• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

실시간 채팅 앱 생성후 username에 관해서 질문드립니다.

21.02.15 23:54 작성 조회수 116

1

## 문제 상황

- 실습대로 진행 후 chatapp(localhost:60003)으로 접속후 username으로 접속을 할 수 없습니다.

- 정확히 코드를 볼줄 모르나, 보통의 chatapp이면 `username`을 쳐서 하나의 계정을 받아서 접속하는 그런 개념(?)으로 application이 작동한다고 생각해서 그런데, 일단 docker-compose.yml은 올려주신 code대로 작성을 하였습니다.

## 해본 내용

- hasura의 console을 접속하기 위한시도했습니다. hasura docs의 getstarted의 using Docker을 참조하여 "localhost:60003/console"로 접속 -> chatapp과 동일한 화면 출력

(이건 username을 사용자가 등록하는 것이 아닌, 등록된 사용자만 접속이 가능한 application이라는 가정하에, 정보가 없어서 로그인을 못한다는 상황)

- postgresql을 `docker exec -it ~`로 접속하여 `psql -U postgres`의 명령어로 postgresql을 접속하여 쿼리해보았는데 다음과 같이 default table이 있었습니다. ( 음.. 생각에는 migration이 되지 않은 것같은데 hasura랑 postgre container가 정상적으로 구동중이라...)

```

postgres=# \l+

                                                                   List of databases

   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   |  Size   | Tablespace |                Description

-----------+----------+----------+------------+------------+-----------------------+---------+------------+--------------------------------------------

 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 |                       | 7877 kB | pg_default | default administrative connection database

 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +| 7877 kB | pg_default | unmodifiable empty database

           |          |          |            |            | postgres=CTc/postgres |         |            |

 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +| 7729 kB | pg_default | default template for new databases

           |          |          |            |            | postgres=CTc/postgres |         |            |

(3 rows)

```

### chatapp page에서 username을 치고 getstart를 누른 후

### chatapp 접속 후 hasura log

```

{"type":"websocket-log","timestamp":"2021-02-15T14:41:37.493+0000","level":"info","detail":{"event":{"type":"accepted"},"connection_info":{"websocket_id":"504a537d-a79e-49d9-b065-8cc19e253a12","token_expiry":null,"msg":null},"user_vars":null}}

{"type":"websocket-log","timestamp":"2021-02-15T14:41:37.493+0000","level":"error","detail":{"event":{"type":"conn_err","detail":"x-hasura-admin-secret/x-hasura-access-key required, but not found"},"connection_info":{"websocket_id":"504a537d-a79e-49d9-b065-8cc19e253a12","token_expiry":null,"msg":null},"user_vars":null}}

{"type":"websocket-log","timestamp":"2021-02-15T14:44:06.954+0000","level":"info","detail":{"event":{"type":"closed"},"connection_info":{"websocket_id":"504a537d-a79e-49d9-b065-8cc19e253a12","token_expiry":null,"msg":null},"user_vars":null}}

{"type":"websocket-log","timestamp":"2021-02-15T14:44:11.921+0000","level":"info","detail":{"event":{"type":"accepted"},"connection_info":{"websocket_id":"92932abf-2ed6-4f32-a03f-33ee3deb79d7","token_expiry":null,"msg":null},"user_vars":null}}

{"type":"websocket-log","timestamp":"2021-02-15T14:44:11.921+0000","level":"error","detail":{"event":{"type":"conn_err","detail":"x-hasura-admin-secret/x-hasura-access-key required, but not found"},"connection_info":{"websocket_id":"92932abf-2ed6-4f32-a03f-33ee3deb79d7","token_expiry":null,"msg":null},"user_vars":null}}

{"type":"http-log","timestamp":"2021-02-15T14:44:15.022+0000","level":"error","detail":{"operation":{"error":{"path":"$","error":"x-hasura-admin-secret/x-hasura-access-key required, but not found","code":"access-denied"},"request_id":"916de49a-a355-43cf-b731-1d8563156880","response_size":111,"raw_query":"{\"operationName\":null,\"variables\":{\"username\":\"username\"},\"query\":\"mutation ($username: String!) {\\n  insert_user(objects: [{username: $username}]) {\\n    returning {\\n      id\\n      username\\n    }\\n  }\\n}\\n\"}"},"http_info":{"status":200,"http_version":"HTTP/1.1","url":"/v1/graphql","ip":"192.168.48.1","method":"POST","content_encoding":null}}}

```

> postgresql은 딱히 logs가 없었습니다.

답변 2

·

답변을 작성해보세요.

1

해결했습니다! 감사합니다ㅎㅎ

1

안녕하세요! hasura console에 접속하여 테이블이 생성되었는지 확인을 하려고 합니다.

localhost:60004 (60003은 웹이고 60004포트가 hasura 입니다) 로 접속한 다음에 DATA 메뉴를 누르고 테이블이 생성되었는지 확인부탁드립니다!