Prisma1: CLI: prisma delete throws Error 400

Created on 4 Apr 2019  ·  17Comments  ·  Source: prisma/prisma1

Describe the bug
I tried to delete the Prisma data of a deployed Instance and it fails with this error:

ERROR: GraphQL Error (Code: 400)

{
  "error": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Bad Request – 400</title>\n    <style>\n      html, body {\n        margin: 0;\n        width: 100%;\n        height: 100%;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n      }\n\n      body {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n        font-size: 15px;\n      }\n\n      .Error {\n        font-size: 1.35em;\n        \n          color: #6061BE;\n        \n      }\n\n      .Error .message {\n        font-weight: 200;\n        letter-spacing: 0.095em;\n      }\n\n      .Error .message a {\n        text-decoration: none;\n        color: inherit;\n        \n          border-bottom: 1px dotted #6061BE;\n        \n      }\n\n      .Error .status {\n        font-weight: 700;\n      }\n\n      .Error .code {\n        display: none;\n      }\n\n      .Error .dot {\n        font-weight: 100;\n      }\n\n      @media screen and (max-width: 800px) {\n        body {\n          font-size: 10px;\n        }\n\n        .Error {\n          display: flex;\n          flex-direction: column;\n        }\n\n        .Error .status {\n          font-size: 1.1em;\n        }\n\n        .Error .dot {\n          display: none\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <div class=\"Error\">\n      <span class=\"status\">Bad Request</span>\n      <span class=\"code\">400</span>\n      <span class=\"dot\">•</span>\n      \n        <span class=\"message\">Please try your request again or contact support.</span>\n      \n    </div>\n  </body>\n</html>",
  "status": 400
}

This happened with Prisma 1.29 and 1.30

prisma delete -f says that everything is fine, but doesn't delete the data either.

To Reproduce
Steps to reproduce the behavior:

  1. try prisma delete -e YOUR-ENV-FILE
  2. see the error

Expected behavior
Prisma-DB is empty after the command

Versions (please complete the following information):

  • Connector: MySQL
  • Prisma Server: 1.30
  • prisma CLI: prisma/1.30.0 (darwin-x64) node-v10.15.3
  • OS: macOS Mojave
aredeploy bu0-needs-info statustale kinbug

Most helpful comment

Using 1.31.0-beta.2 fixed the issue on my end 🙌

All 17 comments

I encountered the same error just by doing prisma deploy after upgrading to prisma 1.30.0.

@Gomah @carstenbaumhoegger

Can you please share your prisma.yml file?

Also, please try the beta version once as it has quite a few fixes regarding this.

Sure, here's my prisma file:

endpoint: ${env:PRISMA_ENDPOINT}

# The file containing the definition of your data model.
datamodel:
  - datamodel/_enums/user-type.graphql
  - datamodel/account/user.graphql

# Generate
generate:
  - generator: typescript-client
    output: ../src/generated/prisma-client/
  - generator: graphql-schema
    output: ../src/generated/prisma.graphql

hooks:
  post-deploy:
    - prisma generate --endpoint
    - npx nexus-prisma-generate --client ./src/generated/prisma-client --output ./src/generated/nexus-prisma # Runs the codegen tool from nexus-prisma.

secret: ${env:PRISMA_SECRET}

seed:
  run: yarn ts-node ./prisma/seed/index.ts

Tried with 1.31.0-beta.1, same issue:

yarn prisma deploy                                                                                                                                                    [e123420]
yarn run v1.15.2
$ prisma deploy

ERROR: GraphQL Error (Code: 400)

{
  "error": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Bad Request – 400</title>\n    <style>\n      html, body {\n        margin: 0;\n        width: 100%;\n        height: 100%;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n      }\n\n      body {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n        font-size: 15px;\n      }\n\n      .Error {\n        font-size: 1.35em;\n        \n          color: #6061BE;\n        \n      }\n\n      .Error .message {\n        font-weight: 200;\n        letter-spacing: 0.095em;\n      }\n\n      .Error .message a {\n        text-decoration: none;\n        color: inherit;\n        \n          border-bottom: 1px dotted #6061BE;\n        \n      }\n\n      .Error .status {\n        font-weight: 700;\n      }\n\n      .Error .code {\n        display: none;\n      }\n\n      .Error .dot {\n        font-weight: 100;\n      }\n\n      @media screen and (max-width: 800px) {\n        body {\n          font-size: 10px;\n        }\n\n        .Error {\n          display: flex;\n          flex-direction: column;\n        }\n\n        .Error .status {\n          font-size: 1.1em;\n        }\n\n        .Error .dot {\n          display: none\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <div class=\"Error\">\n      <span class=\"status\">Bad Request</span>\n      <span class=\"code\">400</span>\n      <span class=\"dot\">•</span>\n      \n        <span class=\"message\">Please try your request again or contact support.</span>\n      \n    </div>\n  </body>\n</html>",
  "status": 400
}

@Gomah @carstenbaumhoegger cc @divyenduz

Please fill this out: https://prisma-io.typeform.com/to/C1JBOT. We are using this form to collect information about the parser bug.

Here's my prisma.yml

I also filled the form you provided 👍

endpoint: ${env:PRISMA_ENDPOINT}

datamodel: datamodel.graphql

seed:
  import: seed.graphql

generate:
  - generator: graphql-schema
    output: ../src/generated/prisma.graphql

hooks:
  post-deploy:
    - prisma generate

secret: ${env:PRISMA_SECRET}

Using 1.31.0-beta.2 fixed the issue on my end 🙌

Same here, 1.30 produced a 400 error, 1.31.0-beta.2 fixed it.
Thanks for sharing @Gomah !

I have now installed CLI 1.31.1 and we are using Prisma 1.30.2.

I'm still experiencing the issue.

Same issue, Prisma1.30.1 and tried Prisma 1.32.0. Also tried CLI 1.30.1 and the beta 1.33.0-beta. prisma deploy, prisma reset both work fine, prisma delete does not work.

Full error (with DEBUG="*"):

Deleting service https://{REDACTED}/models/ci from default...  client Sending query to cloud api +2s
  client https://api2.cloud.prisma.sh +0ms
  client         mutation ($input: ServiceDeletionInput!) {
  client           deleteService(input: $input) {
  client             id
  client           }
  client         }
  client        +0ms
  client { input:
  client    { name: 'models',
  client      clusterName: 'default',
  client      workspaceSlug: null,
  client      stage: 'ci' } } +1ms
  client { headers: {}, agent: undefined } +1ms
 !
Error: GraphQL Error (Code: 400): {"response":{"error":"<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Bad Request – 400</title>\n    <style>\n      html, body {\n        margin: 0;\n
   width: 100%;\n        height: 100%;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n      }\n\n      body {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe
UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n        font-size: 15px;\n      }\n\n      .Error {\n        font-size: 1.35em;\n        \n          color:
#6061BE;\n        \n      }\n\n      .Error .message {\n        font-weight: 200;\n        letter-spacing: 0.095em;\n      }\n\n      .Error .message a {\n        text-decoration: none;\n        color: inherit;\n
   \n          border-bottom: 1px dotted #6061BE;\n        \n      }\n\n      .Error .status {\n        font-weight: 700;\n      }\n\n      .Error .code {\n        display: none;\n      }\n\n      .Error .dot {\n
   font-weight: 100;\n      }\n\n      @media screen and (max-width: 800px) {\n        body {\n          font-size: 10px;\n        }\n\n        .Error {\n          display: flex;\n          flex-direction: column;\n
      }\n\n        .Error .status {\n          font-size: 1.1em;\n        }\n\n        .Error .dot {\n          display: none\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <div class=\"Error\">\n      <span class=\"status\">Bad Request</span>\n      <span class=\"code\">400</span>\n      <span class=\"dot\">•</span>\n      \n        <span class=\"message\">Please try your request again or contact support.</span>\n
   \n    </div>\n  </body>\n</html>","status":400},"request":{"query":"        mutation ($input: ServiceDeletionInput!) {\n          deleteService(input: $input) {\n            id\n          }\n        }\n      ","variables":{"input":{"name":"models","clusterName":"default","workspaceSlug":null,"stage":"ci"}}
   at GraphQLClient.<anonymous> (C:\Users\Gerwim\AppData\Roaming\npm\node_modules\prisma\node_modules\graphql-request\src\index.ts:72:13)
    at step (C:\Users\Gerwim\AppData\Roaming\npm\node_modules\prisma\node_modules\graphql-request\dist\src\index.js:40:23)
    at Object.next (C:\Users\Gerwim\AppData\Roaming\npm\node_modules\prisma\node_modules\graphql-request\dist\src\index.js:21:53)
    at fulfilled (C:\Users\Gerwim\AppData\Roaming\npm\node_modules\prisma\node_modules\graphql-request\dist\src\index.js:12:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  output Exiting with code: 1 +0ms

Same issue here!

@nugoo1
@gerwim
@carstenbaumhoegger

I think this is related to https://github.com/prisma/prisma/issues/4483

Same issue on self-hosted server

Prisma CLI version: prisma/1.34.0 (darwin-x64) node-v11.2.0
Prisma server version: 1.34.0

Same issue on self-hosted server

Prisma CLI version: prisma/1.34.0 (darwin-x64) node-v11.2.0
Prisma server version: 1.34.0

try prisma delete -f after loging in prisma login

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Facing this bug right now, and stuck!
Should drop the schema from RDS? or is that a bad thing to do?

I found out where the issue is coming from, I do not know exactly how to fix it however.

Here is my prisma.yml

endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.prisma
secret: ${env:PRISMA_SECRET}


generate:
    - generator: typescript-client
      output: ./generated/prisma-client
    - generator: graphql-schema
      output: ./generated/prisma.graphql

I have set a secret for the management API but no secret for the service
I have set the secret using the environment variable PRISMA_MANAGEMENT_API_SECRET
I set DEBUG="*"

Deleting service http://myselfhostedservice.com/myservice/testing from default...  client Sending query to cloud api +20s
  client https://api2.cloud.prisma.sh +0ms
  client         mutation ($input: ServiceDeletionInput!) {
  client           deleteService(input: $input) {
  client             id
  client           }
  client         }
  client        +0ms
  client {
  client   input: {
  client     name: 'myservice',
  client     clusterName: 'default',
  client     workspaceSlug: null,
  client     stage: 'testing'
  client   }
  client } +0ms
  client { headers: {}, agent: undefined } +1ms

As you can see from the output prisma delete is for some reason trying to hit the Prisma Cloud endpoint even when I set the env variables to be my self hosted service

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ragnorc picture ragnorc  ·  3Comments

schickling picture schickling  ·  3Comments

schickling picture schickling  ·  3Comments

sedubois picture sedubois  ·  3Comments

hoodsy picture hoodsy  ·  3Comments