Closed fixisoff closed 4 years ago
So, the way I have it setup is that the gatsby-config.js creates a connection string using the values in .env
. Since you are not using a password, you probably have to change how the connection string is structured, I'd imagine.
The error itself, is telling you that the postgres gatsby plugin is not working as intended, most likely due to not being able to connect to the database.
interesting...
so i played around trying to fit your psql setup. i see you put your tables in the public schema and that your user is postgres, which is what i adapted on my db.. PG_USER=postgres PG_PASS=admin PG_HOST=localhost PG_PORT=5432 PG_DB=postgres
now I am seeing another set of two throw errors:
let me know if you have any idea where I can start with. Id really love to be able to reuse some of the fantastic work you did, but if I am just too dumb to run it on my machine I guess Ill have to go back to the drawing board with my code py.
current error:
ERROR #11321 PLUGIN
"gatsby-source-pg" threw an error while running the sourceNodes lifecycle:
PostGraphileQuery.allDeCivilizationstatsList defined in resolvers, but not in schema
Error: PostGraphileQuery.allDeCivilizationstatsList defined in resolvers, but not in schema
success source and transform nodes - 0.764s success building schema - 0.320s
ERROR #85923 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "postgres" on type "Query".
If you don't expect "postgres" to exist on the type "Query" it is most likely a typo. However, if you expect "postgres" to exist there are a couple of solutions to common problems:
- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "postgres" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
File: gatsby-node.js:13:24
ERROR #11321 PLUGIN
"gatsby-node.js" threw an error while running the createPages lifecycle:
Cannot read property 'postgres' of undefined
60 | `); 61 |
62 | const filters = result.data.postgres.currentFilters.nodes; | ^ 63 | const previousFilters = result.data.postgres.previousFilters.nodes; 64 | filters.forEach((filter) => { 65 | const filteredPreviousFilters = previousFilters.filter(
File: gatsby-node.js:62:31
First, I will note that the .env.example file does not contain exactly the values I use in production :) So take it with a grain of salt.
I will say, after you updated it, it looks to be working better. This current appear seems to be a schema issue with your tables:
PostGraphileQuery.allDeCivilizationstatsList defined in resolvers, but not in schema
This looks like a schema issue with the table and then the queries not matching up with the schema. I haven't quite open sourced the schema yet. I will be doing that when I release my developer API. So hang tight.
If you want to, you could infer the schema by inspecting the graphql queries, but... that'd be a bit of a headache.
yeah, I think I'll wait that you release the rest. As I stated earlier, I have already a part of the job done before I even found your work and was hoping to spare myself some effort. maybe Ill just continue with my code directly. maybe a dumb question that I was not able to find directly. where you able to get the result (win/loss) result from the api's call functions? (speaking of the aoe.net ones) All I was able to do is extrapolate it from the rating change of a unique player inbetween two games, but not seeing the result of a specific matchID...
Best of luck. I'll let you know when I open source the backend code.
hi, first off great stuff you are doing here. I was also fiddling with the api provided to aggregate the data and get some valuable stats, but then I saw that you did something much cleaner and sleeker so I decided to try and use your front end. though I am not the most versed in postgres DBs I tried following your guide to setup a development env and for some reason it doesn't work. I am getting> TypeError: Cannot read property 'postgres' of undefined
I have nevertheless setup a DB with postgres as name and no pw, with the 6 tables you require in your guide (and I already have nodejs on my machine). my .env: PG_USER=postgres PG_HOST=127.0.0.1 PG_PORT=5432 PG_DB=myAoeDB
am I missing something?
full error output:
ERROR #85923 GRAPHQL