Josias Duarte Busiquia
07/28/2021, 9:45 PMApolloApi
configuring server.bundle.commandHooks.beforeInstall()
to copy some files over but I'm getting an error:
There was a problem running "beforeInstall" command.
Error: Command failed: pwd && cp apps/data-graph/src/prisma/schema.prisma ${outputDir}/
cp: cannot create regular file '/schema.prisma': Permission denied
Any idea?Frank
ApolloApi
?Josias Duarte Busiquia
07/28/2021, 9:51 PMconst dataGraphApi = new ApolloApi(this, "Api", {
server: {
handler: "apps/data-graph/src/lambda.handler",
bundle: {
nodeModules: [
// node_modules/nexus-plugin-prisma/src/index.ts
"graphql",
"nexus",
"@prisma/client",
"prisma",
],
commandHooks: {
beforeBundling: () => [],
beforeInstall: (inputDir, outputDir) => {
console.log("beforeInstall: ", { inputDir, outputDir })
return ["pwd", "cp -R apps/data-graph/src/prisma ${outputDir}/"]
},
afterBundling: (inputDir, outputDir) => {
console.log("afterBundling: ", { inputDir, outputDir })
return [
"pwd",
"ls -al",
`cd ${outputDir}`,
`yarn prisma generate`,
`rm -rf node_modules/@prisma/engines`,
]
},
},
},
},
})
Josias Duarte Busiquia
07/28/2021, 10:51 PM➜ ll -a .build/
total 768K
drwxrwxr-x 5 iqb iqb 4.0K Jul 28 17:35 .
drwxrwxr-x 15 iqb iqb 4.0K Jul 28 17:35 ..
drwxr-xr-x 2 iqb iqb 4.0K Jul 28 17:35 apps-data-graph-src-lambda-handler-1627508115036
drwxrwxr-x 2 iqb iqb 4.0K Jul 28 17:35 cdk.out
-rw-r--r-- 1 iqb iqb 730K Jul 28 17:35 .esbuild.apps-data-graph-src-lambda-handler.json
-rw-rw-r-- 1 iqb iqb 2.0K Jul 28 17:35 eslint.js
drwxr-xr-x 2 iqb iqb 4.0K Jul 28 17:35 lib
-rw-rw-r-- 1 iqb iqb 2.8K Jul 28 17:35 run.js
-rw-r--r-- 1 iqb iqb 2.2K Jul 28 17:35 sst-debug.log
-rw-rw-r-- 1 iqb iqb 107 Jul 28 17:35 sst-merged.json
iqb
is my linux username.Frank
Frank
console.log("beforeInstall: ", { inputDir, outputDir })
?Frank
return ["pwd", "cp -R apps/data-graph/src/prisma ${outputDir}/"]
can you try this
return ["pwd", `cp -R apps/data-graph/src/prisma ${outputDir}/`]
Frank
Josias Duarte Busiquia
07/28/2021, 10:57 PMWhat did this print out?console.log("beforeInstall: ", { inputDir, outputDir })
beforeInstall: {
inputDir: '.',
outputDir: '.build/apps-data-graph-src-lambda-handler-1627508115036'
}
Josias Duarte Busiquia
07/28/2021, 10:57 PMreplacing the ” with `I'll try
Josias Duarte Busiquia
07/28/2021, 11:14 PMreplacing the ” with `It did work! It was right on face! The pains of copy-pasting 😆. Greatly appreciated @Frank!
Frank