繁体   English   中英

无法在运行时将 schema.gql 写入 Google 的 App Engine NestJS

[英]Cannot write schema.gql to Google's App Engine at runtime NestJS

我正在使用 NestJS,我正在使用他们的 graphql package。

https://docs.nestjs.com/graphql

Nest 在运行时生成 schema.gql 文件。 这会导致 google 的 App Engine 出现问题,因为默认情况下,应用程序无法写入文件系统。

UnhandledPromiseRejectionWarning: Error: EROFS: read-only file system, open 'schema.gql'

我了解在文件系统上存储数据会成为一个问题,但是在运行时生成的这个 schema.gql 文件对于应用程序运行来说是必需的,如果它被复制也没关系。

有没有我失踪的工作? 我可以让它以某种方式生成服务器端吗? 或者有没有办法在应用程序构建时将其与编译时间分开?

任何帮助都会得到帮助:)

向 NestJS Discord 大喊,@TreeMan360 回答了这个问题!

你在哪里:

autoSchemaFile

在你的

GraphqQLModule.forRoot({...

将其设置为:

true

它为您提供了一个仅在 memory 中的自动模式。 我这样做是这样的:

GraphQLModule.forRoot({
      autoSchemaFile: isLocalEnvironment() ? 'api-public.schema.gql' : true,
      playground: !isProductionEnvironment(), ...

按照这些说明解决了我的问题? 漂亮吧?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM