https://www.prisma.io/ logo
Join Slack
Powered by
# orm-help
  • r

    Rodrigo

    05/30/2020, 4:59 PM
    Hi, I'm just starting with graphql and prisma and I'm having issues with a postgres DB in Heroku. The issue is that I can't create a new schema in the postgres instance and everything goes to
    public
    . This is how my docker-compose file looks like:
    Copy code
    version: '3'
    services:
      prisma:
        image: prismagraphql/prisma:1.34
        restart: always
        ports:
        - "4466:4466"
        environment:
          PRISMA_CONFIG: |
            port: 4466
            # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
            # managementApiSecret: my-secret
            databases:
              default:
                connector: postgres
                host: <http://ec2-3-222-30-53.compute-1.amazonaws.com|ec2-3-222-30-53.compute-1.amazonaws.com>
                database: ....
                schema: public
                user: ....
                password: .....
                ssl: true
                rawAccess: true
                port: '5432'
                migrations: true
    r
    • 2
    • 1
  • r

    Rodrigo

    05/30/2020, 5:00 PM
    And this is how the prisma.yml file looks:
    Copy code
    endpoint: <http://localhost:4466/reviews/default>
    datamodel: datamodel.graphql
    The idea is to create a new schema
    reviews$default
    and create tables there
  • r

    Rodrigo

    05/30/2020, 5:01 PM
    This is the
    datamodel.graphql
    file:
    Copy code
    type User {
      id: ID! @id
      name: String!
      createdAt: DateTime! @createdAt
      updatedAt: DateTime! @updatedAt
    }
    If I try to create a new user I get this error:
    Copy code
    "errors": [
        {
          "message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ckatvww0900030724wfxfehnw",
          "path": [
            "createUser"
          ],
          "locations": [
            {
              "line": 2,
              "column": 3
            }
          ],
          "requestId": "local:ckatvww0900030724wfxfehnw"
        }
      ]
  • v

    Vignesh

    05/30/2020, 5:27 PM
    Hi @Rodrigo I guess you are following Andrew Mead.
  • r

    Rodrigo

    05/30/2020, 5:27 PM
    Yep
  • v

    Vignesh

    05/30/2020, 5:28 PM
    I've also struck with same problem. You can see my question above.
  • v

    Vignesh

    05/30/2020, 5:28 PM
    If you find solution to it from any other source, kindly update here.
  • r

    Rodrigo

    05/30/2020, 5:28 PM
    Will
  • r

    Rodrigo

    05/30/2020, 5:28 PM
    do
  • r

    Rodrigo

    05/30/2020, 5:29 PM
    Can you actually run a query in the graphql playground?
  • r

    Rodrigo

    05/30/2020, 5:29 PM
    I can
  • r

    Rodrigo

    05/30/2020, 5:31 PM
    Everything kinds of defaults to the
    public
    schema
  • t

    Troy

    05/30/2020, 9:51 PM
    Hi Prisma people 🙂 I'm building out my first app (ever) and having issues getting Prisma set up. I am hitting this error message: "[GraphQL error]: Message: Your token is invalid. It might have expired or you might be using a token from a different project., Location: undefined, Path: undefined" I have a secret set up in .env and deployed it doesn't seem to be able to read it though?
    • 1
    • 1
  • z

    zth

    05/31/2020, 10:14 AM
    Can I control at what interval an
    @id
    is autoincremented, per model? I'd like to increment them at different intervals in Postgres for different types (example;
    Post
    id:s incremented like
    1, 1001, 2001, 3001, 4001, 5001
    ,
    Author
    incremented at
    2, 2002, 3002, 4002
    , so starting at a different 1st number and then incrementing by 1000)
    r
    • 2
    • 2
  • j

    Jeanre Swanepoel

    05/31/2020, 4:57 PM
    Hi all
  • j

    Jeanre Swanepoel

    05/31/2020, 5:00 PM
    I have two models user and company, company has many users and user belongs to a company
    Copy code
    type Company {
      id: ID! @id
      name: String! @unique
      users: [User]
    }
    type User {
      id: ID! @id
      email: String! @unique
      password: String!
      firstNames: String!
      lastName: String!
      nickName: String!
      mobileNumber: String!
      member: Boolean! @default(value: false)
      leader: Boolean! @default(value: false)
      company: Company!
    }
  • j

    Jeanre Swanepoel

    05/31/2020, 5:01 PM
    but when I execute
    Copy code
    const company = await context.prisma.company({ id: token['companyId'] });
    const user = await context.prisma.createUser({ ...args, password, company  })
    I get the following
    Copy code
    "message": "Variable '$data' expected value of type 'UserCreateInput!' but got: {\"email\":\"<mailto:bob@prisma.io|bob@prisma.io>\",\"password\":\"$2a$10$0SP1mouEQbdyXFHtkBl91.NwoWc6waUFIjZh2NlLzQwpRaQzZmfXm\",\"firstNames\":\"Bob\",\"lastName\":\"Prisma\",\"mobileNumber\":\"0721222323\",\"nickName\":\"Bobby\",\"member\":false,\"leader\":true,\"company\":{\"id\":\"ckav9lduzothk0941ha2qlr5v\",\"name\":\"Fluenty\"}}. Reason: 'company.id' Field 'id' is not defined in the input type 'CompanyCreateOneWithoutUsersInput'. (line 1, column 11):\nmutation ($data: UserCreateInput!) {\n          ^",
  • j

    Jeanre Swanepoel

    05/31/2020, 5:01 PM
    any ideas?
  • j

    Jeanre Swanepoel

    05/31/2020, 5:02 PM
    it seems that it is trying to create the company and not just link the user to that company
  • j

    Jeanre Swanepoel

    05/31/2020, 5:04 PM
    ok nevermind I misread the docs
  • t

    Troy

    05/31/2020, 6:50 PM
    Does anyone know the correct fix for
    Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior.
    I have tried following the steps here:
    Copy code
    yarn cache clean
    yarn upgrade-interactive --latest
    rm -rf node_modules
    npm install
    yarn run dev
    as well as added the following to
    package.json
    :
    Copy code
    "resolutions": {
        "graphql": "^15.0.0"
      },
    but still get the following:
    Copy code
    Error: Cannot use GraphQLNonNull "[Item]!" from another module or realm.
    
    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of other
    relied on modules, use "resolutions" to ensure only one version is installed.
    
    <https://yarnpkg.com/en/docs/selective-version-resolutions>
    
    Duplicate "graphql" modules cannot be used at the same time since different
    versions may have different capabilities and behavior. The data from one
    version used in the function from another could produce confusing and
    spurious results.
    s
    • 2
    • 2
  • p

    Philipp Rajah Moura Srivastava

    06/01/2020, 3:11 PM
    I’m looking to implement a type that has a Time To Live (TTL), in other words it expires after at a specified date and is automatically deleted. I have a relation between this object and another and the onDelete property is set to SET_NULL. Will this delete the connection (the id of the expired instance from the other instance) when the expired instance is deleted?
    r
    t
    • 3
    • 3
  • j

    Jérémie Chazelle

    06/01/2020, 3:19 PM
    What is the best database to use with Prisma please ?
    r
    • 2
    • 1
  • m

    Moray Macdonald

    06/01/2020, 3:31 PM
    Where do I get help with Prisma 1 nowadays? I’m having problems getting prisma to recognise a database after I restore it from a backup
    r
    • 2
    • 2
  • m

    Moray Macdonald

    06/01/2020, 3:32 PM
    Is there a particular channel for support or am I better off on Stack Overflow?
  • s

    Stuart Faircloth

    06/01/2020, 5:03 PM
    Not sure if this is the right place for me to ask a Question - my apologies if its not. I am trying to use serverless-plugin-typescript and would like to add --build to the command line when it builds the ts classes. Is this possible?
    r
    • 2
    • 2
  • m

    Mathieu

    06/02/2020, 9:01 AM
    Hi, has anyone deployed prisma 2 to heroku? I tried using
    npx prisma migrate up --experimental
    on the release phase of the Procfile but npx spits out a
    migrate up is not a prisma command.
    . Whats the correct workflow? are you supposed to migrate the db manually before deploying to heroku? or am i doing something wrong in my Procfile/heroku deployment process.
    a
    u
    • 3
    • 7
  • j

    James Fox

    06/02/2020, 3:55 PM
    Using Prisma with Postgres, is it possible to enforce that a foreign key is one of multiple types?
    Copy code
    model Vote {
      id         String        @id
      type       [ThingA | ThingB] // A vote must be exactly one of these 2
      created_at DateTime      @default(now())
      updated_at DateTime      @updatedAt
    }
    r
    • 2
    • 1
  • l

    Luís Almeida

    06/02/2020, 3:56 PM
    I’m using prisma2.. should I keep using graphql-yoga or move to nexus?
    s
    • 2
    • 1
  • m

    Mike SOK

    06/02/2020, 4:13 PM
    Does anyone have a clue what this error means? Shoot! You provided an invalid argument for the where selector on Item. Please provide exactly one unique field and value. Does it mean that I need to pass @Unique to any of the following apart from the ID field? type Item {     id: ID! @Unique @id     title: String!     description: String!     image: String     largeImage: String     rating: [Rating!] @relation(name: "RatingToItem", onDelete: CASCADE) }
    s
    • 2
    • 1
1...378379380...637Latest