SO Prisma GraphQL error: Whoops. Looks like an internal server error
SO Prisma GraphQL error: Whoops. Looks like an internal server error
进行查询以获取相关表不起作用并显示内部服务器错误。
我尝试多次更改 datamodel.prisma
架构,但均未成功。
当我执行这个查询时:
{
videos {
id
title
sources {
id
quality
}
}
}
它returns这个错误:
{
"data": {
"videos": [
{
"id": "1",
"title": "La peatonal del Vino",
"sources": null
},
{
"id": "2",
"title": "Bodega Diamandes Exterior",
"sources": null
},
{
"id": "3",
"title": "Con Boca",
"sources": null
},
{
"id": "4",
"title": "Rep y el vino",
"sources": null
},
{
"id": "5",
"title": "Pastel de chivo y ciruelas al bonarda acompañado con zapallos en manteca",
"sources": null
},
{
"id": "6",
"title": "Séptimo Clericó",
"sources": null
},
{
"id": "7",
"title": "Las ovejas de Kaiken",
"sources": null
},
{
"id": "8",
"title": "Bodega Diamandes Exterior",
"sources": null
},
{
"id": "9",
"title": "Capítulo Piloto",
"sources": null
}
]
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
0,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
1,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
2,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
3,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
4,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
5,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
6,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
7,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
8,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
}
]
}
这是我的 datamodel.prisma
文件:
"""This is a custom built-in Scalar type from LightHouse. It handles Carbon dates"""
scalar DateTime @scalar(class: "Nuwave\Lighthouse\Schema\Types\Scalars\DateTime")
type Channel {
id: ID! @id
title: String! @isUnique
description: String!
legend: String
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
videos: [Video!]!
banner: Banner @relation(link: INLINE)
}
type Subtitle {
id: ID! @id
code: String!
description: String!
url: String!
video: Video! @relation(link: INLINE)
}
type Source {
id: ID! @id
quality: String!
url: String!
video: Video! @relation(link: INLINE)
}
type Video {
id: ID! @id
title: String! @isUnique
sources: [Source!]!
thumb: String!
duration: Int!
description: String!
legend: String!
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
channel: Channel! @relation(link: INLINE)
subtitles: [Subtitle!]!
}
type Banner {
id: ID! @id
img: String! @isUnique
duration: String!
backgroundColor: String!
buttonColor: String!
textColor: String!
channel: Channel!
}
type User {
id: ID! @id
name: String!
email: String! @isUnique
email_verified_at: DateTime
password: String!
remember_token: String!
created_at: DateTime @created_at
updated_at: DateTime @updated_at
}
这是 Prisma 容器日志的输出:
mmagni@mmagni-lenovo:/var/www/masvino/Server$ sudo docker-compose logs | grep ck1rxkct500rq072706my60la
[sudo] password for mmagni:
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
我该怎么做才能得到这个回复?
{
"data": {
"videos": [
{
"id": "1",
"title": "La peatonal del Vino",
"sources": [
{
"id": "1",
"quality": "320p"
},
{
"id": "2",
"quality": "480p"
},
{
"id": "3",
"quality": "1080p"
}
]
},
...
]
}
}
我试了很多东西都没有成功。 sources
字段不断出现 null
。
更新
错误显示“未知列 RelationTable.channel
”。它应该与列和关系相关联。也许尝试重置您的环境:
尝试prisma export
。删除你的数据库。并用 prisma deploy
重新创建。然后用 prisma import
重新上传你的数据
旧答案
尝试在您的数据模型中的 Source
和 Video
之间添加一个明确的关系名称。
type Source {
id: ID! @id
quality: String!
url: String!
video: Video! @relation(name: "VideoSource")
}
type Video {
id: ID! @id
title: String! @isUnique
sources: [Source!]! @relation(name: "VideoSource")
thumb: String!
duration: Int!
description: String!
legend: String!
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
channel: Channel! @relation(link: INLINE)
subtitles: [Subtitle!]!
}
解决方案是将数据库内容转储到备份文件,删除数据库中的所有表,重新部署 prisma 应用程序并将备份文件导入回数据库。
进行查询以获取相关表不起作用并显示内部服务器错误。
我尝试多次更改 datamodel.prisma
架构,但均未成功。
当我执行这个查询时:
{
videos {
id
title
sources {
id
quality
}
}
}
它returns这个错误:
{
"data": {
"videos": [
{
"id": "1",
"title": "La peatonal del Vino",
"sources": null
},
{
"id": "2",
"title": "Bodega Diamandes Exterior",
"sources": null
},
{
"id": "3",
"title": "Con Boca",
"sources": null
},
{
"id": "4",
"title": "Rep y el vino",
"sources": null
},
{
"id": "5",
"title": "Pastel de chivo y ciruelas al bonarda acompañado con zapallos en manteca",
"sources": null
},
{
"id": "6",
"title": "Séptimo Clericó",
"sources": null
},
{
"id": "7",
"title": "Las ovejas de Kaiken",
"sources": null
},
{
"id": "8",
"title": "Bodega Diamandes Exterior",
"sources": null
},
{
"id": "9",
"title": "Capítulo Piloto",
"sources": null
}
]
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
0,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
1,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
2,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
3,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
4,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
5,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
6,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
7,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
},
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ck1s1nl7d001y0723idytrl5r",
"path": [
"videos",
8,
"sources"
],
"locations": [
{
"line": 5,
"column": 5
}
],
"requestId": "local:ck1s1nl7d001y0723idytrl5r"
}
]
}
这是我的 datamodel.prisma
文件:
"""This is a custom built-in Scalar type from LightHouse. It handles Carbon dates"""
scalar DateTime @scalar(class: "Nuwave\Lighthouse\Schema\Types\Scalars\DateTime")
type Channel {
id: ID! @id
title: String! @isUnique
description: String!
legend: String
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
videos: [Video!]!
banner: Banner @relation(link: INLINE)
}
type Subtitle {
id: ID! @id
code: String!
description: String!
url: String!
video: Video! @relation(link: INLINE)
}
type Source {
id: ID! @id
quality: String!
url: String!
video: Video! @relation(link: INLINE)
}
type Video {
id: ID! @id
title: String! @isUnique
sources: [Source!]!
thumb: String!
duration: Int!
description: String!
legend: String!
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
channel: Channel! @relation(link: INLINE)
subtitles: [Subtitle!]!
}
type Banner {
id: ID! @id
img: String! @isUnique
duration: String!
backgroundColor: String!
buttonColor: String!
textColor: String!
channel: Channel!
}
type User {
id: ID! @id
name: String!
email: String! @isUnique
email_verified_at: DateTime
password: String!
remember_token: String!
created_at: DateTime @created_at
updated_at: DateTime @updated_at
}
这是 Prisma 容器日志的输出:
mmagni@mmagni-lenovo:/var/www/masvino/Server$ sudo docker-compose logs | grep ck1rxkct500rq072706my60la
[sudo] password for mmagni:
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
prisma_1 | {"key":"error/unhandled","requestId":"local:ck1rxkct500rq072706my60la","clientId":"default@default","payload":{"exception":"java.sql.SQLSyntaxErrorException: (conn=397) Unknown column 'RelationTable.channel' in 'field list'","query":"{\n channels {\n id\n title\n videos {\n id\n title\n }\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)\n org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)\n org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)\n org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:173)\n com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$queryToDBIO(SharedSlickExtensions.scala:17)\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO(SharedSlickExtensions.scala:56)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\n slick.basic.BasicBackend$DatabaseDef$$anon.liftedTree1(BasicBackend.scala:276)\n slick.basic.BasicBackend$DatabaseDef$$anon.run(BasicBackend.scala:276)\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n java.lang.Thread.run(Thread.java:748)","message":"(conn=397) Unknown column 'RelationTable.channel' in 'field list'"}}
我该怎么做才能得到这个回复?
{
"data": {
"videos": [
{
"id": "1",
"title": "La peatonal del Vino",
"sources": [
{
"id": "1",
"quality": "320p"
},
{
"id": "2",
"quality": "480p"
},
{
"id": "3",
"quality": "1080p"
}
]
},
...
]
}
}
我试了很多东西都没有成功。 sources
字段不断出现 null
。
更新
错误显示“未知列 RelationTable.channel
”。它应该与列和关系相关联。也许尝试重置您的环境:
尝试prisma export
。删除你的数据库。并用 prisma deploy
重新创建。然后用 prisma import
旧答案
尝试在您的数据模型中的 Source
和 Video
之间添加一个明确的关系名称。
type Source {
id: ID! @id
quality: String!
url: String!
video: Video! @relation(name: "VideoSource")
}
type Video {
id: ID! @id
title: String! @isUnique
sources: [Source!]! @relation(name: "VideoSource")
thumb: String!
duration: Int!
description: String!
legend: String!
shownOnPremieres: Boolean!
shownOnTheMostSeen: Boolean!
shownOnExploreEverything: Boolean!
channel: Channel! @relation(link: INLINE)
subtitles: [Subtitle!]!
}
解决方案是将数据库内容转储到备份文件,删除数据库中的所有表,重新部署 prisma 应用程序并将备份文件导入回数据库。