Giter Club home page Giter Club logo

Comments (3)

cgtopher avatar cgtopher commented on June 11, 2024 1

Logs from running .connect()

{"timestamp":"2024-04-03T23:49:14.423644Z","level":"INFO","fields":{"message":"Starting a postgresql pool with 5 connections."},"target":"quaint::pooled"}
{"timestamp":"2024-04-03T23:49:14.494218Z","level":"INFO","fields":{"message":"Started query engine http server on http://127.0.0.1:37103","ip":"127.0.0.1","port":"37103"},"target":"query_engine::server"}
Traceback (most recent call last):
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 206, in connect_tcp
    sock = socket.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
    yield
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 231, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
    raise exc
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
    response = connection.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
    raise exc
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
    stream = self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 124, in _connect
    stream = self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
    with map_exceptions(exc_map):
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/engine/_query.py", line 208, in spawn
    data = self.request('GET', '/status')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/engine/_http.py", line 150, in request
    response = self.session.request(method, url, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/_sync_http.py", line 25, in request
    return Response(self.session.request(method, url, **kwargs))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_client.py", line 828, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 230, in handle_request
    with map_httpcore_exceptions():
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/<home-dir>/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/_base_client.py", line 305, in connect
    self._internal_engine.connect(
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/engine/_query.py", line 190, in connect
    self.spawn(file, timeout=timeout, datasources=datasources)
  File "/<home-dir>/venv/lib/python3.11/site-packages/prisma/engine/_query.py", line 229, in spawn
    raise errors.EngineConnectionError('Could not connect to the query engine') from last_exc
prisma.engine.errors.EngineConnectionError: Could not connect to the query engine

from prisma-client-py.

vikyw89 avatar vikyw89 commented on June 11, 2024

same here

from prisma-client-py.

egcash avatar egcash commented on June 11, 2024

Exactly same issue

Bug description

Getting "Connection Refused" error on connect to db. I've tested the networking with psql to verify my connection isn't getting blocked by firewalls, using same connection details.

How to reproduce

Not sure how reproducible this can be, but this is the minimal code I've been using to test it (normally running inside a flask application running behind gunicorn).

(venv) <user>@ubuntu-s-2vcpu-4gb-amd-sfo3-01:/<home-dir># export PRISMA_PY_DEBUG=1 && python
Python 3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from prisma import Prisma
>>> import logging
>>> p = Prisma()
>>> logging.getLogger('prisma').setLevel(logging.DEBUG)
>>> p.connect()

I'll put resulting logs in comments.

Expected behavior

Connects to database

Prisma information

generator client {
  provider             = "prisma-client-py"
  interface            = "sync"
  recursive_type_depth = 5
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Environment & setup

  • OS: Ubuntu 23.10
  • Database: PostgreSQL
  • Python version: 3.11.6
  • Prisma version:
prisma                  : 5.11.0
prisma client python    : 0.13.0
platform                : debian-openssl-3.0.x
expected engine version : efd2449663b3d73d637ea1fd226bafbcf45b3102
installed extras        : []
install path            : /<home-dir>/venv/lib/python3.11/site-packages/prisma
binary cache dir        : /<user>/.cache/prisma-python/binaries/5.11.0/efd2449663b3d73d637ea1fd226bafbcf45b3102

Exactly same issue

from prisma-client-py.

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.