When using Postgraphile with express, I can connect to my database, but when running the server via node dist/index.js
:
Not working in index.js
const postgraphileOptions: PostGraphileOptions = {
subscriptions: true,
watchPg: true,
dynamicJson: true,
setofFunctionsContainNulls: false,
ignoreRBAC: false,
showErrorStack: 'json',
extendedErrors: ['hint', 'detail', 'errcode'],
appendPlugins: [require('@graphile-contrib/pg-simplify-inflector')],
exportGqlSchemaPath: 'schema.graphql',
graphiql: true,
enhanceGraphiql: true,
allowExplain(_req: any) {
// TODO: customise condition!
return true;
},
enableQueryBatching: true,
legacyRelations: 'omit',
// pgSettings(req: any) {
// /* TODO */
// },
jwtSignOptions: { algorithm: 'RS256' },
jwtPgTypeIdentifier: 'public.jwt_token',
jwtSecret: 'secret',
};
app.use(
postgraphile(
process.env.DATABASE_URL || postgres://postgres:postgres@localhost:5432/my-db,
'private',
{ ...postgraphileOptions }
)
);
- The even though I've used comments in the db to hide introspection of some tables in the
public
schema, these introspections are not hidden. - Nothing in the private schema shows introspection (even when I only specify
private
in thePostGraphileOptions
).
Here's the confusing part. If I run the server using the postgraphile cli
, I will see proper introspection and my manually hidden items are not shown.
postgraphile --jwt-token-identifier public.jwt_token --jwt-secret 'secret' -c 'postgres://postgres:postgres@localhost:5432/my-db' -s public,private --watch --enhance-graphiql --dynamic-json
I hope I have provided enough info here. Cheers and thanks in advance!