在控制台中抛出错误,但不是从应用程序中抛出错误

问题描述 投票:0回答:1

“在类型:‘query_root’中找不到字段‘todos’”

如果从应用程序运行查询,我不会收到此错误

但如果它是从 Hasura Console 运行的,请务必获取

为什么?

该应用程序只是 nhost 演示应用程序的副本

https://github.com/srghma/nativescript-testapp/blob/7ca234c4d95ec3415f8c2b8974103127cbad0cd7/docker-compose.yml#L48-L66

https://github.com/srghma/nativescript-testapp/blob/7ca234c4d95ec3415f8c2b8974103127cbad0cd7/nextjs-server-components/src/app/protected/todos/%5B%5B...pagination%5D%5D/page.tsx #L23

https://github.com/srghma/nativescript-testapp/blob/7ca234c4d95ec3415f8c2b8974103127cbad0cd7/nhost-backend/nhost/metadata/databases/default/tables/public_todos.yaml#L1

-- this is taken from hasura logs when I access http://localhost:3000/protected/todos page
x-hasura-role user
x-hasura-user-id e2edb294-514b-463a-84fa-4a43e004d09a
x-hasura-user-is-anonymous false

all ok if admin creating user1 creating user2 creating user3 take id with id query doesnt work permissions are ok

也发布在这里

https://github.com/hasura/graphql-engine/issues/10546

hasura nhost
1个回答
0
投票

如果您使用 JWT 身份验证,则不能仅从日志中获取角色和用户 ID 并将其发送到标头中,您需要使用有效的 JWT 令牌。 Hasura 引擎将从 JWT 中提取您的会话变量,例如用户 ID 和角色。

https://discord.com/channels/407792526867693568/1287397028804165642/1287798115339862098

© www.soinside.com 2019 - 2024. All rights reserved.