I am currently facing an issue whilst deploying to AWS lambda. I have used the nexus-prisma example from the examples directory and deployed using the serverless framework.
After deploying and accessing the playground, this error is logged in Cloudwatch:
EROFS: read-only file system, unlink '/var/task/node_modules/@types/nexus-prisma-typegen/index.d.ts'

Do we need to add any separate configuration for lambdas?
@ryands17 to prevent this error just pass {shouldGenerateArtifacts: false} in the options you provide to nexusPrismaPlugin(options):
Example:
const schema = makeSchema({
types: [Query, Mutation, Post, User],
plugins: [nexusPrismaPlugin({
shouldGenerateArtifacts: false
})],
outputs: {
schema: __dirname + '/generated/schema.graphql',
typegen: __dirname + '/generated/nexus.ts',
},
typegenAutoConfig: {
contextType: 'Context.Context',
sources: [
{
source: '@prisma/client',
alias: 'prisma',
},
{
source: require.resolve('./context'),
alias: 'Context',
},
],
},
})
If google has brought you here for this error and the fix above doesn't seem to work, you may wish to ensure the plugin version you're running matches the latest version of the documentation — as of this writing the flag has been moved out of the plugins array, and now appears at the top level of makeSchema:
makeSchema({
types,
shouldGenerateArtifacts: process.env.NODE_ENV === 'development'
...
})
I had the same error as @ryands17 above, and this configuration tweak allowed me to get past it.
@langer Does this still work with you with nexus 1.0.0? I've tried the same thing, but unfortunately still get the error.
@sreuter now the original is what's working for us:
plugins: [
nexusSchemaPrisma({
shouldGenerateArtifacts: true,
}),
],
EDIT: i was mistaken — just noticed when trying to modify our schema that a new enum wasn't getting an artifact generated. i'm investigating now but it appears to be the case that node_modules/.prisma/client/index.js is being successfully regenerated while node_modules/.prisma/client/index.d.ts is not.
Most helpful comment
@ryands17 to prevent this error just pass
{shouldGenerateArtifacts: false}in the options you provide tonexusPrismaPlugin(options):Example: