keystonejs / prisma-day-2021-workshop Goto Github PK
View Code? Open in Web Editor NEWResources for Jed's Prisma Day 2021 Workshop
License: MIT License
Resources for Jed's Prisma Day 2021 Workshop
License: MIT License
Here's the run time error when a radio button on the poll is clicked:
GraphQLError: Variable "$where" got invalid value "ckuiwvnze01962sesh3jjp9dm" at
"where.poll.answers.some.id"; Expected type "IDFilter" to be an object.
at C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\execution\values.js:116:15
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:83:7)
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:105:34)
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:105:34)
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:105:34)
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:105:34)
at coerceInputValueImpl (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:54:14)
at coerceInputValue (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\utilities\coerceInputValue.js:37:10)
at _loop (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\execution\values.js:109:69)
at coerceVariableValues (C:\msys64\home\jonathan\proj\from-serv\pr2\k26\prisma-day-2021-workshop\node_modules\graphql\execution\values.js:121:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
const auth = useAuth()
console.log(auth.sessionData) // undefined
sessionData is retruned undefined. can any one help please. Thank you
Next.js has to access KS for gql queries to render the site SSG, but it has no session attached, so is rejected by server side filtering. This leads to a situation where it is impossible to build a static site that employs filtering, which this project does (document status).
The only obvious solution I can see is for KS to offer two endpoints, one for SSG, without filtering, and a live version accessed only by the front end and admin UI, with filtering.
Without this functionality, the new filter api has greatly restricted the use cases of keystone (currently, this app can only be done SSR, or SSG without any filtering, i.e. drafts are visible), all due to filtering playing badly with auth.
Unless there is a straight forward way round these issues, it's is a show stopper for me, because I'm looking to produce sites with a large SSG component.
Here's the error code where it all clicked ...
> Build error occurred
Error: GraphQL errors occurred:
An error occured while running "Access control".
- Post.access.filter.query: Cannot read property 'session' of undefined
i.e. Post.access.filter.query is running at Build time
Urrrghhh
My repo has a largely fixed up version of this app. But I've been stopped in my tracks with these issues, and will be investigating other ways to do CMS as a priority. I'll update my repo to the latest version for reference purposes, but it too, is not fully working. There's no point fixing the minor auth/filter problems while such a major issue is outstanding upstream.
The only other way round this I can think of is to associate the nextjs build process with a session. Google is of no help here, so I'm assuming it's not easy? TBF any CMS with server side filtering has to cope with this situation, unless certain fields can be openly tested within access: operation: (in this case, the status field). This is a complication, and exposes details about all documents on the site, including unauthorised content.
Even with the two endpoint method, nextjs has to be told to use different ports for SSG and the live site ... i.e. it's major hackery.
Another route is to integrate the nextjs build methods into KS ... right now it feels like the only method that guarantees success? But it's a fairly major undertaking ... and introduces versionitis risks, i.e. every version of next needs a corresponding CMS version.
Urrghhhhhhh.
Preliminary searches shows next.js can only use a single port. It's like we are short of a hook. So, (assuming I've got the situation assessed correctly) the only way to build a static site for a restricted version of this app is a multi stage build process, which has many caveats. But again, tbf, any sufficiently powerful CMS will run into this problem ...
Because this is a generic problem (common to any sufficiently powerful CMS) it must require a generic solution, and it looks almost forced ... it starts with a hacked version of Next that uses a separate port for SSG to tunnel through the CMS firewall.
This is a bizarre situation were I pray I am wrong, and there is an easy way round this deadlock using existing tools.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.