Closed warrenisarobot closed 2 years ago
I have the latest postgraphile version installed and just ran a test without issue. Although, due to other old packages I had to force a specific version of graphql using the new package.json overrides
field. Can you run npm ls graphql
(or the yarn equivalent) and let me know if there are other versions used and if this package has one of those versions (maybe a snippet/screenshot would be nice). I'm just curious.
What's interesting here is that package "graphql" is not installed on this project (see the package.json). I was relying on that being installed from postgraphile (or another package). I suppose NodeJS just found the first version on your project's dependencies or nested dependencies and used it.
What's also interesting is where GraphQLNonNull
was used (directly from postgraphile's context object), which is what your initial error is from.
I also see there's still a 'graphql' import used on the plugin types file. I suppose this really doesn't matter since it was only used for types and is probably ignored/discarded in compilation.
I also suppose I missed GraphQLList
being on the postgraphile context object (that or my code autocompleted and imported it). Good Catch and thanks for your contribution. I'll merge this and push the update.
I bet you're right about the auto-complete since all the other graphql objects come from the context object.
You should be able to duplicate with this Dockerfile:
FROM node:alpine
LABEL description="Postgraphile test"
RUN npm install -g postgraphile
RUN npm install -g postgraphile-plugin-many-create-update-delete@1.0.6
ENTRYPOINT ["postgraphile", "-n", "0.0.0.0", "--append-plugins","postgraphile-plugin-many-create-update-delete"]
From the folder this Dockerfile
is in you'd do a:
docker build -t pgtest .
Set the database url as an env var (if the db is running on your local machine use the host host.docker.internal
instead of localhost
:
export DATABASE_URL=postgres://user:pass@host.docker.internal:5432/dbname
Then run:
docker run --env DEBUG="graphile-build:warn" pgtest --connection=$DATABASE_URL
This will give you the error above if the db is able to connect.
In the container if I want to do a npm list -g graphql
I do a:
docker run --entrypoint="npm" pgtest ls -g graphql
This is the output for that:
When using this plugin on the current version of postgraphile mutations are no longer included and I get the following error:
This is due to the graphql import in 2 packages. This uses the included
graphql
object provided from postgraphile so the import is not needed. This solves the error and mutations are included, along with themn
prefixed mutations.