Not all of # import file is being copied
Closed this issue · 0 comments
So I have the following code, which copies my schema.graphql
and generated prisma.graphl
files and creates a single file combining both files (I'm doing so because of the following issue: https://github.com/zeit/now-examples/issues/201), which in turn is read into prisma.:
import { importSchema } from "graphql-import";
import * as fs from "fs";
const text = importSchema("src/schema.graphql");
fs.writeFileSync("src/schema_prep.graphql", text)
with my schema.graphql
defined as follows:
# import * from './generated/prisma.graphql'
type SuccessMessage {
...
}
type Mutation {
...
}
type Query {
...
}
type User {
...
}
Now, all of the schema.graphql
is successfully copied to schema_prep.graphql
but not all of the imported prisma.graphql
is.
The total line count of the imported prisma.graphql
by itself is 4521 lines and schema.graphql
is 43 lines, whereas the total line count of the combined schema_prep.graphql
file is only 2381 lines.
As the complete file is not correctly copied, when doing this:
const db = new Prisma({
typeDefs: __dirname + "/schema_prep.graphql",
endpoint: process.env.PRISMA_ENDPOINT,
secret: process.env.PRISMA_SECRET,
debug: false,
});
the folowing error is issued:
Debugger listening on ws://127.0.0.1:9229/faf3c2ef-d5bb-4ba1-8845-e802db24b7f2
For help see https://nodejs.org/en/docs/inspector
C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\prisma-binding\dist\utils.js:1
TypeError: Cannot read property 'type' of undefined
at getWhere (C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\prisma-binding
\dist\utils.js:45:9)
at C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\prisma-binding\dist\util
s.js:38:20
at Array.map (<anonymous>)
at Object.getTypesAndWhere (C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules
\prisma-binding\dist\utils.js:33:23)
at Prisma.buildExists (C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\pris
ma-binding\dist\Prisma.js:75:33)
at new Prisma (C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\prisma-bindi
ng\dist\Prisma.js:65:30)
at Object.<anonymous> (C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\src\db.js:4:12)
at Generator.next (<anonymous>)
What is the issue here?