prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.55k stars 868 forks source link

Prisma deploy don't show error when token is invalid. #2267

Closed huv1k closed 6 years ago

huv1k commented 6 years ago

Bug Report

Current behavior When deploying prisma-cli shows nothing changed instead of invalid token. I discovered it with graphql -p database diff and there i got invalid token.

Reproduction Have invalid token and try to deploy to cloud.

Expected behavior? Show error message

marktani commented 6 years ago

Hm, what kind of invalid token are you talking about? Are you talking about a service token, that is generated with prisma token and used to send queries and mutations to the Prisma API? Because deploying doesn't need that token.

marktani commented 6 years ago

Ah, I believe to make graphql -p database diff work for protected Prisma services you need to manually adjust .graphqlconfig.yml to include a valid header.

The problem with graphql -p database diff seems unrelated to deploying. Is there a second problem you experience with deploying?

huv1k commented 6 years ago

I want to deploy with prisma deploy, even that I have changes in my database model there is no difference between my schemas.

marktani commented 6 years ago

Ok, the two problems seem unrelated to me 🙂

When you enabled debug output and then deploy, does that reveal more information?

On fish shell, you can enable debug output like to: set -x DEBUG "*"

huv1k commented 6 years ago

This is result with my deployment in fragment MigrationFragment on Migration i have new schema, but i nothing changes

  config CWD /Users/huvik/Projects/33justsystem/packages/server +0ms
  config HOME /Users/huvik +2ms
  config definitionDir /Users/huvik/Projects/33justsystem/packages/server/database +6ms
  config definitionPath /Users/huvik/Projects/33justsystem/packages/server/database/prisma.yml +0ms
  cli { isGlobal: true } +0ms
  StatusChecker setting status checker +0ms
  cli command id deploy +7ms
  cli:plugincache Got plugin from cache +0ms
  cli:plugincache /Users/huvik/Library/Caches/prisma/plugins.json +0ms
  cli:plugincache Got plugin from cache +1ms
  cli:plugincache /Users/huvik/Library/Caches/prisma/plugins.json +0ms
  plugins findCommand prisma-cli-core +0ms
  plugin requiring command +0ms
  cli-engine:plugins:manager requiring /usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core +0ms
  cli-engine:plugins:manager required +309ms
  plugin required command +312ms
  Environment [ 'prisma-eu1', 'prisma-us1' ] +0ms
  Environment { 'prisma-eu1': 'https://eu1.prisma.sh',
  Environment   'prisma-us1': 'https://us1.prisma.sh' } +0ms
  StatusChecker setting status checker +622ms
  deploy run +475ms
  client Sending query to cluster justmighty +0ms
  client https://justmighty_justmighty.prisma.sh/cluster +0ms
  client
  client       query($name: String! $stage: String!) {
  client         project(name: $name stage: $stage) {
  client           name
  client           stage
  client         }
  client       }
  client      +1ms
  client { name: 'justsystem', stage: 'prod' } +0ms
  client { project: { name: 'justsystem', stage: 'prod' } } +231ms

Deploying service `justsystem` to stage `prod` on cluster `justmighty/justmighty`...  client Sending query to cluster justmighty +3ms
  client https://justmighty_justmighty.prisma.sh/cluster +0ms
  client       mutation($name: String!, $stage: String! $types: String! $dryRun: Boolean $secrets: [String!], $subscriptions: [FunctionInput!]) {
  client         deploy(input: {
  client           name: $name
  client           stage: $stage
  client           types: $types
  client           dryRun: $dryRun
  client           secrets: $secrets
  client           subscriptions: $subscriptions
  client         }) {
  client           errors {
  client             type
  client             field
  client             description
  client           }
  client           migration {
  client             ...MigrationFragment
  client           }
  client         }
  client       }
  client
  client fragment MigrationFragment on Migration {
  client   revision
  client   steps {
  client     type
  client     __typename
  client     ... on CreateEnum {
  client       name
  client       ce_values: values
  client     }
  client     ... on CreateField {
  client       model
  client       name
  client       cf_typeName: typeName
  client       cf_isRequired: isRequired
  client       cf_isList: isList
  client       cf_isUnique: unique
  client       cf_relation: relation
  client       cf_defaultValue: default
  client       cf_enum: enum
  client     }
  client     ... on CreateModel {
  client       name
  client     }
  client     ... on CreateRelation {
  client       name
  client       leftModel
  client       rightModel
  client     }
  client     ... on DeleteEnum {
  client       name
  client     }
  client     ... on DeleteField {
  client       model
  client       name
  client     }
  client     ... on DeleteModel {
  client       name
  client     }
  client     ... on DeleteRelation {
  client       name
  client     }
  client     ... on UpdateEnum {
  client       name
  client       newName
  client       values
  client     }
  client     ... on UpdateField {
  client       model
  client       name
  client       newName
  client       typeName
  client       isRequired
  client       isList
  client       isUnique: unique
  client       relation
  client       default
  client       enum
  client     }
  client     ... on UpdateModel {
  client       name
  client       um_newName: newName
  client     }
  client   }
  client }
  client
  client      +0ms
  client { name: 'justsystem',
  client   stage: 'prod',
  client   types: 'enum INVITATIONSTATUS {\n  ACCEPTED\n  PENDING\n  BLOCKED\n}\n\nenum MEMBERLEVEL {\n  BASIC\n  ADMIN\n}\n\nenum USERLEVELS {\n  USER\n  ADMIN\n}\n\nenum TYPES {\n  BLOG\n  SHOP\n  CASESTUDY\n  EMPLOYEES\n  CAREER\n  SERVICE\n  MEDIA\n  FORMS\n}\n\nenum URLTYPE {\n  BLOG\n  SHOP\n  CASESTUDY\n  EMPLOYEES\n  CAREER\n  SERVICE\n  MEDIA\n  CUSTOM\n}\n\nenum MEDIATYPE {\n  IMAGE\n  VIDEO\n}\n\nenum VIDEOTYPE {\n  YOUTUBE\n  VIMEO\n}\n\ntype Url {\n  id: ID! @unique\n  link: String\n  parentLink: String\n  title: String\n  career: Career\n  service: Service\n  website: Website\n  type: URLTYPE!\n  secondaryType: URLTYPE\n}\n\ntype File {\n  contentType: String!\n  createdAt: DateTime!\n  id: ID! @unique\n  name: String!\n  secret: String! @unique\n  size: Int!\n  updatedAt: DateTime!\n  alt: String @default(value: "")\n  url: String! @unique\n  user: User\n  folder: Folder\n  post: Post\n  detailImage: Person @relation(name: "PersonDetail")\n}\n\ntype Folder {\n  id: ID! @unique\n  name: String!\n  description: String\nfiles: [File!]!\n  organization: Organization!\n}\n\ntype User {\n  createdAt: DateTime!\n  email: String @unique\n  phone: String\n  id: ID! @unique\n  name: String!\n  surname: String\n  password: String!\nupdatedAt: DateTime!\n  posts: [Post!]!\n  services: [Service!]!\n  blocked: Boolean @default(value: false)\n  dribble: String\n  facebook: String\n  github: String\n  image: File\n  instagram: Instagram\n  linkedin: String\n  memberships: [Membership!]!\n  employee: Employee\n  twitter: String\n  userLevel: USERLEVELS @default(value: USER)\n  author: Person @relation(name: "PersonAuthor")\n  person: [Person!]! @relation(name: "PersonUser")\n}\n\ntype Membership {\n  id: ID! @unique\n  invitationStatus: INVITATIONSTATUS! @default(value: PENDING)\n  membership: MEMBERLEVEL! @default(value: BASIC)\n  organization: Organization\n  user: User\n}\n\ntype Organization {\n  id: ID! @unique\n  membership: [Membership!]!\n  name: String! @unique\n  websites: [Website!]!\n  folders: [Folder!]!\n  dribbble: Dribbble\n}\n\ntype Website {\n posts: [Post!]!\n  createdAt: DateTime!\n  id: ID! @unique\n  modules: [TYPES!]\n  services: [Service!]!\n  name: String! @unique\n  organization: Organization\n  url: String!\n  categories: [Category!]!\n  urls: [Url!]!\n}\n\ntype Category {\n  id: ID! @unique\n  createdAt: DateTime!\n  updatedAt: DateTime!\n  name: String!\n  description: String\n  categoryType: TYPES!\n  website: Website\n}\n\ntype Tag {\n  id: ID! @unique\n  createdAt: DateTime!\n  updatedAt: DateTime!\n  name: String!\n  tagType: TYPES!\n  website: Website!\n}\n\ntype Thumbnail {\n  id: ID! @unique\n  image: File!\n  type: MEDIATYPE!\n  videoType: VIDEOTYPE\n  video: String\n}\n\ntype Post {\n  author: User\n  createdAt: DateTime!\n  id: ID! @unique\n  updatedAt: DateTime!\n  url: Url @relation(name: "PostUrl", onDelete: CASCADE)\n  title: String!\n  description: String!\n  content: Json\n  contentRaw: String\n  readingTime: Float\n  thumbnail: Thumbnail @relation(name: "PostThumbnail", onDelete: CASCADE)\n  website: Website\n  services: [Service!]!\n  published: Boolean @default(value: "false")\n  publishDate: DateTime\n  categories: [Category!]!\n}\n\ntype Employee {\n  id: ID! @unique\n  createdAt: DateTime!\n  updatedAt: DateTime!\n  user: User\n  phone: String\n email: String\n  position: String\n  name: String\n  message: String\n  detail: String\n  content: String\n}\n\ntype Career {\n  id: ID! @unique\n  createdAt: DateTime!\n  updatedAt: DateTime!\n  date: DateTime!\n  published: Boolean!\n  title: String!\n  description: String\n  type: String\n  content: Json\n  contentRaw: String\n  website: Website\n  url: Url @relation(name: "CareerOnUrl", onDelete: CASCADE)\n  author: User\n}\n\ntype CaseStudy {\n  author: User\n  createdAt: DateTime!\n  id: ID! @unique\n  url: Url @relation(name: "CaseStudyUrl", onDelete: CASCADE)\n  title: String!\n  description: String\n  content: Json\n  contentRaw: String\n  thumbnail: Thumbnail @relation(name: "CaseStudyThumbnail", onDelete: CASCADE)\n  website: Website\n  published: Boolean @default(value: "false")\n  publishDate: DateTime\n  categories: [Category!]!\n  tags: [Tag!]!\n  detail: String\n  detailImage: File\n}\n\ntype Service {\n  id: ID! @unique\n  title: String!\n  description: String\n  author: User\n  website: Website\n  content: Json\n  contentRaw: String\n  thumbnail: Thumbnail @relation(name: "Servicehumbnail", onDelete: CASCADE)\n  url: Url @relation(name: "ServiceUrl", onDelete: CASCADE)\n  published: Boolean! @default(value: false)\n  publishDate: DateTime\n  posts: [Post!]!\n  categories: [Category!]!\n}\n\ntype Person {\n  id: ID! @unique\n  title: String!\n  position: String\n  description: String\n  author: User @relation(name: "PersonAuthor")\n  user: User @relation(name: "PersonUser")\n  website: Website\n  content: Json\n  contentRaw: String\n  thumbnail: Thumbnail @relation(name: "PersonThumbnail", onDelete: CASCADE)\n  url: Url @relation(name: "PersonUrl", onDelete: CASCADE)\n  published: Boolean! @default(value: false)\n  publishDate: DateTime\n  detailImage: File @relation(name: "PersonDetail")\n}\n\ntype Dribbble {\n  id: ID! @unique\n  name: String!\n  token: String!\n  organization: Organization!\n  posts: [DribbblePost!]!\n}\n\ntype DribbblePost {\n  dribbble: Dribbble\n  dribbbleId: ID! @unique\n  title: String\n  url: String\n  date: DateTime\ntype: MEDIATYPE\n  lowResolution: String\n  highResolution: String\n}\n\ntype Instagram {\n  id: ID! @unique\n  accessToken: String!\n  name: String!\n  instagramId: String!\n  user: User\n  media: [InstagramMedia!]! @relation(name: "InstagramPosts", onDelete: CASCADE)\n}\n\ntype InstagramMedia {\n  id: ID! @unique\n  type: String!\n  mediaUrl: String!\n  thumbnailUrl: String\n  permalink: String!\n  likeCount: Int!\n  timestamp: DateTime!\n  instagram: Instagram\n}\n\n',
  client   dryRun: undefined,
  client   secrets: [ SECRET ],
  client   subscriptions: [] } +1ms
  client { deploy: { errors: [], migration: { revision: 0, steps: [] } } } +304ms
huv1k commented 6 years ago

Okay, looks like it isn't related to token. Because when i upgrade prisma from 1.6.0 -> 1.7.1 i get warnings about: You already have nodes for this model.

huv1k commented 6 years ago

Okay fixed, It was because of an old version of graphql