prisma / prisma-admin-feedback

Feedback for Prisma Admin (currently in invite-only preview)
6 stars 1 forks source link

Prisma Admin stuck in loading state #130

Open nikolasburk opened 5 years ago

nikolasburk commented 5 years ago

This is my Docker Compose file:

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.31
    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: mysql
            host: mysql
            user: root
            password: prisma
            rawAccess: true
            port: 3306
            migrations: true
  mysql:
    image: mysql:5.7
    restart: always
    # Uncomment the next two lines to connect to your your database from outside the Docker environment, e.g. using a database GUI like Workbench
    ports:
    - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: prisma
    volumes:
      - mysql:/var/lib/mysql
volumes:
  mysql:

This is my datamodel:

type User @db(name: "user") {
  id: ID! @id
  createdAt: DateTime! @createdAt
  email: String! @unique
  name: String
  role: Role @default(value: USER)
  posts: [Post!]!
  profile: Profile @relation(link: INLINE)
}

type Profile @db(name: "profile") {
  id: ID! @id
  user: User!
  bio: String!
}

type Post @db(name: "post") {
  id: ID! @id
  createdAt: DateTime! @createdAt
  updatedAt: DateTime! @updatedAt
  title: String!
  author: User!
  published: Boolean! @default(value: false)
  categories: [Category!]! @relation(link: TABLE, name: "PostToCategory")
}

type Category @db(name: "category") {
  id: ID! @id
  name: String!
  posts: [Post!]! @relation(name: "PostToCategory")
}

type PostToCategory @db(name: "post_to_category") @relationTable {
  post: Post
  category: Category
}

enum Role {
  USER
  ADMIN
}

When I'm trying to access http://localhost:4466/_admin, I'm stuck in a loading state:

image

Clearing localStorage and hard refreshing the page both didn't work. I don't see any console errors and the network requests in the devtools also seem ok... 🤷‍♀️

image

sdnts commented 5 years ago

Narrowed this down to the migrations and rawAccess flags in the database options in docker-compose.yml. The container crashes, and fails to serve queries. This should be fixed with the next version of the Docker image. Keeping this open so I can verify once that happens!

In the mean time, removing those flags should fix this.

Swoorup commented 5 years ago

Same issue.

oliverandersencox commented 5 years ago

Fixed - in case anyone else runs into this:

gillianbc commented 5 years ago

Thank you very much - worked for me too

yutzuhsuan commented 5 years ago

Worked for me, thank you so much.

AmazingTurtle commented 5 years ago

Setting rawAccess to false in the PRISMA_CONFIG environment variable in the docker-compose file worked for me. Using prismagraphql/prisma:1.34

cyrieu commented 5 years ago

Hey unfortunately we're building a project that needs rawAccess: true in the docker-compose.yml file, would love to see a new image pushed so we can use admin!

nealoke commented 5 years ago

As @AmazingTurtle states, disabling rawAccess works, but what is rawAccess anyway?

anton6 commented 5 years ago

@nealoke https://github.com/prisma/prisma/issues/2052

nealoke commented 5 years ago

@anton6 is there an advantage over using this via using knex.js for using sql then?

theRocket commented 5 years ago

Confirmed the rawAccess solution works for me on prismagraphql/prisma:1.34. I tried it without migrations, but I put it back and Prisma Admin is still available. I want migrations but don't need rawAccess yet, so I'll leave it out until it is fixed.

nodabladam commented 4 years ago

Any way to get admin with migrations and rawAccess yet?