graphile-contrib/postgraphile-plugin-connection-filter

Please add `tslib` as a dependency

benjie opened this issue · 0 comments

In a clean environment when installed globally the lack of tslib causes the plugin to fail to load. To reproduce, create Dockerfile:

FROM node:alpine

RUN npm install -g postgraphile
RUN npm install -g postgraphile-plugin-connection-filter

EXPOSE 5000
ENTRYPOINT ["postgraphile", "-n", "0.0.0.0"]

build it:

docker build .

then run it (replace HASH_FROM_PREVIOUS_STEP with whatever hash you got at the end of the docker build output and the postgres connection string with whatever makes sense for you):

docker run --rm -it --net=host HASH_FROM_PREVIOUS_STEP -c postgres://username:password@localhost/test --append-plugins postgraphile-plugin-connection-filter

Error trace:

Failed to load plugin 'postgraphile-plugin-connection-filter'
/usr/local/lib/node_modules/postgraphile/build/postgraphile/cli.js:287
            throw e;
            ^

Error: Cannot find module 'tslib'
Require stack:
- /usr/local/lib/node_modules/postgraphile-plugin-connection-filter/dist/index.js
- /usr/local/lib/node_modules/postgraphile/build/postgraphile/cli.js
- /usr/local/lib/node_modules/postgraphile/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/postgraphile-plugin-connection-filter/dist/index.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/postgraphile-plugin-connection-filter/dist/index.js',
    '/usr/local/lib/node_modules/postgraphile/build/postgraphile/cli.js',
    '/usr/local/lib/node_modules/postgraphile/cli.js'
  ]
}

If you don't append the plugin then there is no error.

Issue originally filed by @kevinmamaqi here: graphile/graphile.github.io#278