beeman
10/31/2018, 1:16 AMbeeman
10/31/2018, 1:16 AMbeeman
10/31/2018, 1:17 AMpapomolina
10/31/2018, 1:25 AMZefex Developer
10/31/2018, 1:33 AMZefex Developer
10/31/2018, 2:42 AMexport default {
Query: {
user: (parent, { id }, { database }) =>
database.query.user({ where: { id } })
}
}
pedro
10/31/2018, 3:14 AMpedro
10/31/2018, 3:15 AMNick
10/31/2018, 4:30 AMrein
10/31/2018, 8:50 AMhalborg
10/31/2018, 10:03 AMtype User {
posts: [Post!]!
}
type Post {
id: ID! @unique
title: String!
}
type Comment {
id: ID! @unique
content: String!
author: User!
}
and a query of
{
users(first: 100) {
posts {
comments {
content
}
}
}
}
and a one-line Prisma resolver such as
resolve: async (parent, { first, after }, ctx, info) => {
return ctx.db.query.usersConnection({ first, after }, info),
}
(where db
is of type Prisma
in the generated schema)
it will fetch all of the posts, and all of the comments for each post for a 100 users, which is an obvious attack vector and a performance problem.
How do I resolve that in Prisma?
(forum post here: https://www.prisma.io/forum/t/how-to-limit-queries-on-nested-lists-with-prisma-bindings/4851)theom
10/31/2018, 10:10 AM{
"data": null,
"errors": [
{
"message": "Cannot return null for non-nullable field User.permissions.",
"locations": [
{
"line": 14,
"column": 5
}
],
"path": [
"signin",
"permissions"
]
}
]
}
when attempting to run the following mutation. What am I overlooking:
mutation SIGNIN_MUTATION($email: String!, $password: String!, $pathname: String!) {
signin(email: $email, password: $password, pathname: $pathname) {
id
name
email
permissions
}
}
based on the following schema and datamodel
schema
type Mutation {
signin(email: String!, password: String!, pathname: String!): User!
}
datamodel
type User {
id: ID! @unique
name: String!
email: String! @unique
password: String!
resetToken: String
resetTokenExpiry: String
permissions: [Permission]
cart: [CartItem!]!
}
joao.santos
10/31/2018, 11:54 AMZefex Developer
10/31/2018, 1:13 PMrem
10/31/2018, 1:36 PMprisma introspect
fails (for the same reason). I can connect to both servers via the CLI - anyone seen this/tips?yolen
10/31/2018, 2:12 PMconst server = new GraphQLServer({
typeDefs: './src/schema.graphql',
port: 8080,
resolvers,
context: {
db: prisma,
},
} as any)
. runs fine and I can get the playground up and running..... but on port 4000 NOT 8080. I have tried other ports but no cigar. I found this old issue https://github.com/prisma/graphql-yoga/issues/281Nick
10/31/2018, 3:11 PMDrew Delianides
10/31/2018, 3:28 PMdivyendu
10/31/2018, 3:35 PMdivyendu
10/31/2018, 3:56 PMDorkside
10/31/2018, 3:56 PMaman06
10/31/2018, 6:14 PMrooneyK
10/31/2018, 6:24 PMrooneyK
10/31/2018, 6:27 PMrooneyK
10/31/2018, 6:40 PM# database-generated input
input TagCreateInput {
name: String
description: String
type: TagTypes
createdBy: UserCreateOneWithoutCreatedTagsInput!
}
input TagCreateInput {
name: String
description: String
type: TagTypes
}
Now, in this example, the bottom one (publicly exposes) is what the user can see and interact with. Note that we have simply compied that whole Tag
from the database and removed createdBy
. This does work, but the maintenance-level is high for this solution, especially as tables evovle with more and more relations, nesting etc. There are so many ways that a Tag
might be created. I am wondering, is it possible, to instead of copying the whole input-object and removing the fields we don't want publicly available, would it be possible to instead something like extending input with removal of some specific fields? Or is there a different solution available?Keegan
10/31/2018, 7:25 PMmfcarneiro
10/31/2018, 8:07 PMmfcarneiro
10/31/2018, 8:08 PMkimf
10/31/2018, 9:57 PMinfo
attribute we noticed that if the client leaves out “externalServiceId” we can’t use that attribute in a later stage in the code…Mitch
11/01/2018, 5:24 AMERROR: Workspace mitch does not exist
{
"data": {
"generateClusterToken": null
},
"errors": [
{
"message": "Workspace mitch does not exist",
"locations": [
{
"line": 3,
"column": 9
}
],
"path": [
"generateClusterToken"
],
"code": 222
}
],
"status": 200
}
It was previously working and I have since set my app up with a new workspace/service, but I am still wondering what happened to the last one. Any insight would be appreciated 🙂