简体   繁体   中英

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

I am using NestJS and I am using their graphql package.

https://docs.nestjs.com/graphql

Nest Generates the schema.gql file at run time. This is causing an issue with google's App Engine because by default, applications can't write to the file system.

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

I understand how this would be a problem for storing data on the file system, but this schema.gql file that is generated at runtime is nessecary for the app to run and doesn't matter if it gets replicated.

Is there a work around I am missing? Can I get this to generate serverside somehow? Or is there a way I could make it apart of compile time when the application builds?

Any help is appriciated:)

Shout out to the NestJS Discord where this question got answered by @TreeMan360!

Where you have:

autoSchemaFile

in your

GraphqQLModule.forRoot({...

set it to:

true

which gives you an automatic, in memory only, schema. I do this like so:

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

Following these instructions solved my problem? Niffty huh?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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