本地开发中Hasura与Supabase集成问题及经验问询
本地集成Hasura GraphQL Engine与Supabase经验求助
项目背景
- 现有项目通过Hasura CLI、Console管理,已将PostgreSQL数据库从Heroku迁移至Supabase
- 目标:后端(NextApiRequest处理器)使用SupabaseClient实现图片上传,前端继续沿用apollo/client
遇到的问题
- supabase_db_app拒绝连接
- 收到上游服务器无效响应,关联supabase_auth_app镜像,伴随错误:
ERROR: no schema has been selected to create、ERROR: Migrator: problem creating schema migrations ERROR: extension "pg_graphql" must be installed in schema "graphql"- PostgreSQL本地端口54322连接失败:
received invalid response to SSL negotiation
已尝试的解决方案
- 按Supabase文档执行
supabase init和supabase start操作 - 使用以下docker-compose.yml配置Hasura:
version: '3.6' services: hasura: image: hasura/graphql-engine:v2.15.1 container_name: hasura networks: - default - supabase_network_app ports: - 8081:8080 # supabase_pg_meta_app also runs on 8080/tcp # depends_on: # - "postgres" restart: always environment: HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgres@192.168.0.2:5432/postgres #feel free to replace/test with: postgres://postgres:postgres@host.docker.internal:54322/postgres HASURA_GRAPHQL_ENABLE_CONSOLE: "true" HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS: "true" HASURA_GRAPHQL_DEV_MODE: "true" HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log HASURA_GRAPHQL_ADMIN_SECRET: $HASURA_GRAPHQL_ADMIN_SECRET HASURA_GRAPHQL_JWT_SECRET: '{ "type": "RS512", "jwk_url": "$AUTH0_ISSUER_BASE_URL/.well-known/jwks.json" }' networks: supabase_network_app: name: supabase_network_app external: true driver: bridge
- 按常规流程应用Hasura的迁移、元数据、种子数据
- 从Supabase参考库创建数据库转储并应用到本地开发环境,此操作解决了supabase_auth_app容器启动错误:
pg_dump --clean --if-exists --quote-all-identifiers \ -h SUPABASE_URL -U postgres -d postgres \ > supabase_dump.sql
psql -h localhost -p 54322 -U postgres -f supabase_dump.sql
现寻求各位分享本地开发中集成Hasura GraphQL Engine与Supabase的相关经验。
内容的提问来源于stack exchange,提问作者renderVis
相关产品推荐
相关产品推荐

