GithubHelp home page GithubHelp logo

Comments (10)

kerimamansaryyev avatar kerimamansaryyev commented on June 20, 2024 1

@medz It's ready, you can check #363. I made it detailed and clarified

from prisma-dart.

medz avatar medz commented on June 20, 2024

It seems like this is a repetitive problem, but there are many reasons that cause unpreparedness. I will look for an existing issue, hoping it will be helpful to you,

from prisma-dart.

medz avatar medz commented on June 20, 2024

#322
#161

from prisma-dart.

SL-Pirate avatar SL-Pirate commented on June 20, 2024

Sorry for jumping right in but are you using sqlserver by any chance?
Because for some reason I got the exact same error. Despite the sort of unhelpful error message I suspected this should have something to do with the connection string so I started searching for a way to validate the connection string. And it also looked pretty fine. Finally I tried npx prisma migrate dev
Then it complained Error: P1011: Error opening a TLS connection: The TLS settings didn't allow the connection to be established. Please review your connection string. (error: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1919: (self signed certificate))
After this point it was a breeze to debug.

I found my answer here

I had to add encrypt=false;trustServerCertificate=true to my DATABASE_URL. I'm not sure the encryption parameter is required but trustServerCertificate=true was the real fix.

PS: I'm not sorry if I sound disrespectful. I was stuck there for a few hours.

from prisma-dart.

medz avatar medz commented on June 20, 2024

@SL-Pirate I'm glad you found the problem 😊, I don't feel offended. Thank you for your reply. The same errors in different databases may come from different reasons.

Prisma's errors are not so open and transparent, so it is difficult for me to cover all the errors. But I will make it better in my limited time. Friendly error messages are also one of them. There are almost no contributors to this project. Although it is not satisfactory, I have been trying my best.

from prisma-dart.

SL-Pirate avatar SL-Pirate commented on June 20, 2024

Yes, I totally understood that. I also contribute to open source so I understand your situation. I was on edge but knowing your situation I was trying my best to keep my cool.
Now that I'm cool I want to thank you for maintaining and developing this package. I'm really glad this exists and if it didn't I wouldn't know what to do.

Again sorry if I was even a bit rude :)

from prisma-dart.

kerimamansaryyev avatar kerimamansaryyev commented on June 20, 2024

Yesss, FINALLY, I solved the same issue. I am using Mac M1. Here are the things that you need to check @PrzemyslawPluszowy @SL-Pirate

  1. Make sure that you run npx prisma db push. So you have updated schema on your database.
  2. Make sure to give host name to your database container and set DATABASE_URL with the host name as envirionment variable, don't use localhost when containerizing.

These fixed my issue

from prisma-dart.

kerimamansaryyev avatar kerimamansaryyev commented on June 20, 2024

I am working on an open-source project so I can post my DockerFike and docker-compose there. By the way, how I detected the fixes? When the dart frog server runs inside the container it tells: Running on http://:::8080. Fore sure, it has ip within InternetAddress object but not the host name. So, maybe, the containers do not come with default localhost host name.

Here is the docker compose:

version: "3"
services:

  # Launch the db first
  ribbit_database:
    container_name: ribbit_database
    hostname: ribbitdb
    image: mysql:latest
    restart: unless-stopped
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: myPassword123
      MYSQL_DATABASE: hellav
      MYSQL_USER: kerim
      MYSQL_PASSWORD: myPassword123

  # Launch this after
  ribbit_main_service:
    container_name: ribbit_main_service
    build:
      dockerfile: ./ribbit_main_service/Dockerfile
      args:
        - DATABASE_URL=mysql://kerim:myPassword123@ribbitdb:3306/hellav
    ports:
      - "8080:8080"
    environment:
      - PORT=8080
      - JWT_SECRET=MyBiggestS3cr3t
      - DATABASE_URL=mysql://kerim:myPassword123@ribbitdb:3306/hellav

networks:
  ribbit:
    external: true

Here is the DockerFile:

FROM dart:stable AS build

# Download npm to work with prisma within the build phase involving Dart
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
    apt-get install -y nodejs

# Copying middle-end package
WORKDIR /app/ribbit_middle_end

COPY ribbit_main_service/ribbit_middle_end/pubspec.* ./
RUN dart pub get

COPY ribbit_main_service/ribbit_middle_end/. .

WORKDIR /app/ribbit_server

# Copying the server package
COPY ribbit_main_service/ribbit_server/pubspec.* ./
RUN dart pub get

COPY ribbit_main_service/ribbit_server/. .


# Expose DATABASE_URL as build-time env variable for prisma
ARG DATABASE_URL

# Generate prisma-related files
RUN npm install prisma
RUN npx prisma generate

# Generate other Dart classes
RUN dart pub run build_runner build

# Bundle the project
RUN dart pub global activate dart_frog_cli
RUN dart pub global run dart_frog_cli:dart_frog build

# Generate executable
RUN dart pub get --offline
RUN dart compile exe build/bin/server.dart -o build/bin/server

# Configure runtime for prisma
RUN FILES="libz.so libgcc_s.so libssl.so libcrypto.so"; \
    for file in $FILES; do \
    so="$(find / -name "${file}*" -print -quit)"; \
    dir="$(dirname "$so")"; \
    mkdir -p "/runtime${dir}"; \
    cp "$so" "/runtime$so"; \
    echo "Copied $so to /runtime${so}"; \
    done


FROM scratch

# Copy runtime from previous build phase
COPY --from=build /runtime/ /

# Copy the source to review it within the Docker Container later
COPY --from=build /app/ribbit_server/. /app/source/

# Copy executable from the previous phase
COPY --from=build /app/ribbit_server/build/bin/server /app/bin/
# Copy executable the binary engine
COPY --from=build /app/ribbit_server/prisma-query-engine /app/bin/

# Prepare to execute the server within /app/bin/
WORKDIR /app/bin/

# Add required environment variables
ENV JWT_SECRET = "default-secret"
ENV PORT = 8080
ENV DATABASE_URL = ""

# Execute the server executable
CMD ["/app/bin/server"]

from prisma-dart.

kerimamansaryyev avatar kerimamansaryyev commented on June 20, 2024

@medz I think I could contribute into the docs about containerizing the Prisma since I'd been gathering the info into a whole for 3 days. I will read the guide

from prisma-dart.

medz avatar medz commented on June 20, 2024

@kerimamansaryyev Thank you very much, your PRs are always welcome❤️

from prisma-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.