pulumi_docker.docker.ResourceError: No digest available for image - pulumi

I got errors when I run pulumi up.
Error:
pulumi_docker.docker.ResourceError: No digest available for image 1234567890987.dkr.ecr.us-west-2.amazonaws.com/cloud/abcd-svc-4c4ac5e
pulumi up
versions:
pulumi==3.40.1
pulumi-aws==5.15.0
pulumi-docker==3.4.1
python-dotenv==0.21.0
Type Name Plan Info
pulumi:pulumi:Stack abcdef-staging-1234567890987 1 error; 1 message
├─ docker:image:Image cloud/abcd-svc
└─ aws:ssm:Parameter ABCD_APP_MYSQL_DB_HOST create
Diagnostics:
pulumi:pulumi:Stack (abcdef-staging-1234567890987):
error: Program failed with an unhandled exception:
Traceback (most recent call last):
File "/home/ubuntu/.pulumi/bin/pulumi-language-python-exec", line 179, in <module>
loop.run_until_complete(coro)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
await wait_for_rpcs()
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 73, in wait_for_rpcs
await RPC_MANAGER.rpcs.pop()
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
[Previous line repeated 25 more times]
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 514, in do_register
resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 124, in prepare_resource
serialized_props = await rpc.serialize_properties(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
result = await serialize_property(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 375, in serialize_property
is_known = await output._is_known
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
[Previous line repeated 20 more times]
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 514, in do_register
resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 124, in prepare_resource
serialized_props = await rpc.serialize_properties(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
result = await serialize_property(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 378, in serialize_property
value = await serialize_property(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 361, in serialize_property
future_return = await asyncio.ensure_future(awaitable)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 124, in get_value
val = await self._future
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 170, in run
value = await self._future
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 451, in gather_futures
return await _gather_from_dict(value_futures_dict)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 630, in _gather_from_dict
results = await asyncio.gather(*tasks.values())
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 124, in get_value
val = await self._future
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 685, in do_register_resource_outputs
serialized_props = await rpc.serialize_properties(outputs, {})
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
result = await serialize_property(
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 375, in serialize_property
is_known = await output._is_known
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 168, in run
is_known = await self._is_known
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 215, in run
return await cast(Awaitable[U], transformed)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi_docker/docker.py", line 243, in build_and_push_image
build_result = await build_image(base_image_name, path_or_build, log_resource, cache_from)
File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi_docker/docker.py", line 444, in build_image
raise ResourceError(
pulumi_docker.docker.ResourceError: No digest available for image 1234567890987.dkr.ecr.us-west-2.amazonaws.com/cloud/abcd-svc-4c4ac5e
E1011 06:09:05.598323428 59188 fork_posix.cc:76] Other threads are currently calling into gRPC, skipping fork() handlers
Output of pulumi about
CLI
Version 3.41.1
Go Version go1.19.1
Go Compiler gc
Plugins
NAME VERSION
aws 5.15.0
docker 3.4.1
python unknown
Host
OS ubuntu
Version 20.04
Arch x86_64
This project is written in python: executable='/home/ubuntu/works/cloud/deployment/src/abcdapp/venv/bin/python3' version='3.9.5
'
TYPE URN
pulumi:pulumi:Stack urn:pulumi:staging-accountid::abcdapp::pulumi:pulumi:Stack::abcdapp-staging-accountid
pulumi:providers:aws urn:pulumi:staging-accountid::abcdapp::pulumi:providers:aws::default
docker:image:Image urn:pulumi:staging-accountid::abcdapp::docker:image:Image::cloud/abcdapp-svc
pulumi:providers:aws urn:pulumi:staging-accountid::abcdapp::pulumi:providers:aws::default_5_15_0
aws:ecr/repository:Repository urn:pulumi:staging-accountid::abcdapp::aws:ecr/repository:Repository::cloud/abcdapp-svc
aws:cloudwatch/logGroup:LogGroup urn:pulumi:staging-accountid::abcdapp::aws:cloudwatch/logGroup:LogGroup::/ecs/abcdapp-svc
aws:ecr/lifecyclePolicy:LifecyclePolicy urn:pulumi:staging-accountid::abcdapp::aws:ecr/lifecyclePolicy:LifecyclePolicy::abcdapp-svc-lifecycle-policy
aws:lb/targetGroup:TargetGroup urn:pulumi:staging-accountid::abcdapp::aws:lb/targetGroup:TargetGroup::tg-abcdapp-svc
aws:iam/role:Role urn:pulumi:staging-accountid::abcdapp::aws:iam/role:Role::abcdapp-svc-exec-role
aws:iam/role:Role urn:pulumi:staging-accountid::abcdapp::aws:iam/role:Role::abcdapp-svc-task-role
aws:iam/rolePolicyAttachment:RolePolicyAttachment urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-exec-policy
aws:iam/rolePolicyAttachment:RolePolicyAttachment urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-exec-ssm-access-policy
aws:iam/rolePolicyAttachment:RolePolicyAttachment urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-ecs-access-policy
aws:ec2/securityGroup:SecurityGroup urn:pulumi:staging-accountid::abcdapp::aws:ec2/securityGroup:SecurityGroup::abcdapp-svc-secgrp
aws:iam/rolePolicyAttachment:RolePolicyAttachment urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-ssm-access-policy
aws:ec2/securityGroup:SecurityGroup urn:pulumi:staging-accountid::abcdapp::aws:ec2/securityGroup:SecurityGroup::abcdapp-svc-secgrp-db
aws:lb/loadBalancer:LoadBalancer urn:pulumi:staging-accountid::abcdapp::aws:lb/loadBalancer:LoadBalancer::lb-abcdapp-svc
aws:lb/listener:Listener urn:pulumi:staging-accountid::abcdapp::aws:lb/listener:Listener::lis-abcdapp-svc
aws:rds/instance:Instance urn:pulumi:staging-accountid::abcdapp::aws:rds/instance:Instance::abcdapp-svc-rds
Backend
Name pulumi.com
URL https://app.pulumi.com/peter6
User peter6
Organizations peter6
Dependencies:
NAME VERSION
common-variables 1.4.4
coverage 6.4.4
deployment 1.4.0
mock 4.0.3
pip 22.2.2
pkg_resources 0.0.0
pytest 7.1.3
requests 2.28.1
setuptools 65.3.0
wheel 0.37.1
Pulumi locates its logs in /tmp by default

Use pulumi-docker==3.1.0 solves the problem.

Related

Error when using find/find_one pymongo methods when on an apache2 server (mongodb atlas)

when using find/find_one pymongo methods when on an apache2 server i get the following error :
No <class 'cryptography.x509.extensions.TLSFeature'> extension was found
when using pymongo on an apache2 server to connect and insert or delete in my mongodb collections it works just fine, but when i try to pull something out of the database (using find or find_one methods) i get an error, please note that this error only occurs while running the apache2 server, because when i connected and used find methods in a locally run python script it gave me the information without any errors.
if it is of any relevance, the web framework i am using is flask.
Edit : As for what is producing the error i dont know for sure, so here are the logs.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/var/www/html/srv21/SRVApp.py", line 17, in downloadpage
ThreadID = ThreadID.next()
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1165, in _refresh
self.__send_message(q)
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1052, in __send_message
response = client._run_operation(
File "/usr/local/lib/python3.10/dist-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "/usr/local/lib/python3.10/dist-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1442, in _retryable_read
with self._socket_from_server(read_pref, server, session) as (sock_info, read_pref):
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1282, in _socket_from_server
with self._get_socket(server, session) as sock_info:
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1217, in _get_socket
with server.get_socket(handler=err_handler) as sock_info:
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1407, in get_socket
sock_info = self._get_socket(handler=handler)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1520, in _get_socket
sock_info = self.connect(handler=handler)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1358, in connect
sock = _configured_socket(self.address, self.opts)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1061, in _configured_socket
sock = ssl_context.wrap_socket(sock, server_hostname=host)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 369, in wrap_socket
ssl_conn.do_handshake()
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 125, in do_handshake
return self._call(super(_sslConn, self).do_handshake, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 108, in _call
return call(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1894, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1603, in _raise_ssl_error
self._context._ocsp_helper.raise_if_problem()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 319, in raise_if_problem
raise self._problems.pop(0)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 539, in wrapper
valid = callback(conn, ocsp_data, data)
File "/usr/local/lib/python3.10/dist-packages/pymongo/ocsp_support.py", line 298, in _ocsp_callback
ext = _get_extension(cert, _TLSFeature)
File "/usr/local/lib/python3.10/dist-packages/pymongo/ocsp_support.py", line 114, in _get_extension
return cert.extensions.get_extension_for_class(klass)
File "/usr/local/lib/python3.10/dist-packages/cryptography/x509/extensions.py", line 135, in get_extension_for_class
raise ExtensionNotFound(
cryptography.x509.extensions.ExtensionNotFound: No <class 'cryptography.x509.extensions.TLSFeature'> extension was found

Prisma python client - Postgres can't establish connection

i'm unsuccessfully trying to connect my python project to a postgres DB using Prisma
I'm following this https://prisma-client-py.readthedocs.io/en/stable/
# schema.prisma
generator db {
provider = "prisma-client-py"
interface = "asyncio"
}
datasource db {
provider = "postgresql"
url = "postgresql://imb123:pass3876#localhost:5432/ibm123?schema=public"
}
model Post {
id String #id #default(cuid())
created_at DateTime #default(now())
updated_at DateTime #updatedAt
title String
published Boolean
desc String?
}
main.py
import asyncio
from prisma import Prisma
async def main() -> None:
db = Prisma()
await db.connect()
post = await db.post.create(
{
'title': 'Hello from prisma!',
'desc': 'Prisma is a database toolkit and makes databases easy.',
'published': True,
}
)
print(f'created post: {post.json(indent=2, sort_keys=True)}')
found = await db.post.find_unique(where={'id': post.id})
assert found is not None
print(f'found post: {found.json(indent=2, sort_keys=True)}')
await db.disconnect()
if __name__ == '__main__':
asyncio.run(main())
db push and prisma generate finished successfully meaning the connect from CLI is ok.
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_defined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------------+---------------------------------------+------------+------------------------------+----------------------+---------------------------+--------------------------+------------------------+--------------------+----------+---------------
ibm123 | public | Post | BASE TABLE | | | | | | YES | NO |
The error raised from await db.connect()
/Users/ibm123/PycharmProjects/pythonProject/venv/bin/python /Users/ibm123/PycharmProjects/pythonProject/main.py
Traceback (most recent call last):
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
await get_running_loop().create_connection(
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
raise exceptions[0]
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
sock = await self._connect_sock(
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 500, in sock_connect
return await fut
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 535, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('::1', 59712, 0, 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
yield
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
raise exc
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(request)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
raise exc
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
stream = await self._connect(request)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
return await self._backend.connect_tcp(
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/engine/query.py", line 161, in spawn
data = await self.request('GET', '/status')
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/engine/http.py", line 96, in request
resp = await self.session.request(method, url, **kwargs)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/_async_http.py", line 28, in request
return Response(await self.session.request(method, url, **kwargs))
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_client.py", line 1614, in send
response = await self._send_handling_auth(
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
response = await self._send_handling_redirects(
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
response = await self._send_single_request(request)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_client.py", line 1716, in _send_single_request
response = await transport.handle_async_request(request)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ibm123/PycharmProjects/pythonProject/main.py", line 25, in <module>
asyncio.run(main())
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/Users/ibm123/PycharmProjects/pythonProject/main.py", line 6, in main
await db.connect()
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/client.py", line 238, in connect
await self.__engine.connect(
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/engine/query.py", line 109, in connect
await self.spawn(file, timeout=timeout, datasources=datasources)
File "/Users/ibm123/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/prisma/engine/query.py", line 180, in spawn
raise errors.EngineConnectionError(
prisma.engine.errors.EngineConnectionError: Could not connect to the query engine

NotImplementedError asynchronous

I'm trying to use fastapi connect to Postgresql with async,but I got a NotimplementError,
It's seems the coderecord = await objects.get(test5, orderId=result['orderId'])
cause this problem.
but I don't know how to fixed it
there is some solution in network,but it did'n work
import platform
import asyncio
if platform.system() == "Windows":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
*code
import peewee_async
import peewee_asyncext
from fastapi import FastAPI
from playhouse.postgres_ext import *
db = peewee_asyncext.PooledPostgresqlExtDatabase(
database = 'postgres',
host = '127.17.0.2',
port = '5432',
user = 'postgres',
password = 1234,
register_hstore = False,
max_connections = 20,
connect_timeout = 3
)
objects = peewee_async.Manager(database =db)
db.set_allow_sync = False
class test5(Model):
orderId = FixedCharField(primary_key = True)
transactionId = FixedCharField()
class Meta:
database = db
table_name = 'test'
app = FastAPI()
#app.post("/test")
async def test():
result = {
"orderId":"test",
"transactionId":"123"
}
try:
record = await objects.get(test5, orderId=result['orderId'])
except Exception as e:
if str(e) == "":
await objects.execute(test5.insert(result))
return result
*request
import requests,json
data={}
url='http://127.0.0.1:8000/test'
r=requests.post(url,json.dumps(data))
print(r.text)
*error
Future exception was never retrieved
future: <Future finished exception=NotImplementedError()>
Traceback (most recent call last):
File "D:\Python\lib\site-packages\peewee_async.py", line 852, in connect_async
await conn.connect()
File "D:\Python\lib\site-packages\peewee_async.py", line 1014, in connect
self.pool = await aiopg.create_pool(
File "D:\Python\lib\site-packages\aiopg\pool.py", line 300, in from_pool_fill
await self._fill_free_pool(False)
File "D:\Python\lib\site-packages\aiopg\pool.py", line 336, in _fill_free_pool
conn = await connect(
File "D:\Python\lib\site-packages\aiopg\connection.py", line 65, in connect
connection = Connection(
File "D:\Python\lib\site-packages\aiopg\connection.py", line 772, in __init__
self._loop.add_reader(
File "D:\Python\lib\asyncio\events.py", line 504, in add_reader
raise NotImplementedError
NotImplementedError
Future exception was never retrieved
future: <Future finished exception=NotImplementedError()>
Traceback (most recent call last):
File "C:\Users\user\Desktop\test\others\.\test5.py", line 39, in test
record = await objects.get(test5, orderId=result['orderId'])
File "D:\Python\lib\site-packages\peewee_async.py", line 166, in get
await self.connect()
File "D:\Python\lib\site-packages\peewee_async.py", line 302, in connect
await self.database.connect_async(loop=self.loop, timeout=self._timeout)
File "D:\Python\lib\site-packages\peewee_async.py", line 852, in connect_async
await conn.connect()
File "D:\Python\lib\site-packages\peewee_async.py", line 1014, in connect
self.pool = await aiopg.create_pool(
File "D:\Python\lib\site-packages\aiopg\pool.py", line 300, in from_pool_fill
await self._fill_free_pool(False)
File "D:\Python\lib\site-packages\aiopg\pool.py", line 336, in _fill_free_pool
conn = await connect(
File "D:\Python\lib\site-packages\aiopg\connection.py", line 65, in connect
connection = Connection(
File "D:\Python\lib\site-packages\aiopg\connection.py", line 772, in __init__
self._loop.add_reader(
File "D:\Python\lib\asyncio\events.py", line 504, in add_reader
raise NotImplementedError
NotImplementedError
*Windows version info:
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] on
win32
Windows 10 Pro, version 20H2, OS build 19042.1526

Why Pgadmin gives me 500 error? _pickle.PicklingError: Can't pickle <class 'wtforms.form.Meta'>: attribute lookup Meta on wtforms.form failed

Occasionally, Pgadmin gives me the 500 error in a browser. After reloading the page, the issue disappears for a while and then comes back again. Here's the log I see while getting the error:
[2022-01-21 14:35:21 +0000] [93] [ERROR] Error handling request /authenticate/login
Traceback (most recent call last):
File "/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 271, in handle
keepalive = self.handle_request(req, conn)
File "/venv/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/venv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/pgadmin4/pgAdmin4.py", line 77, in __call__
return self.app(environ, start_response)
File "/venv/lib/python3.8/site-packages/werkzeug/middleware/proxy_fix.py", line 169, in __call__
return self.app(environ, start_response)
File "/venv/lib/python3.8/site-packages/flask_socketio/__init__.py", line 43, in __call__
return super(_SocketIOMiddleware, self).__call__(environ,
File "/venv/lib/python3.8/site-packages/engineio/middleware.py", line 74, in __call__
return self.wsgi_app(environ, start_response)
File "/venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/venv/lib/python3.8/site-packages/flask/app.py", line 1953, in full_dispatch_request
return self.finalize_request(rv)
File "/venv/lib/python3.8/site-packages/flask/app.py", line 1970, in finalize_request
response = self.process_response(response)
File "/venv/lib/python3.8/site-packages/flask/app.py", line 2269, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "/pgadmin4/pgadmin/utils/session.py", line 307, in save_session
self.manager.put(session)
File "/pgadmin4/pgadmin/utils/session.py", line 166, in put
self.parent.put(session)
File "/pgadmin4/pgadmin/utils/session.py", line 270, in put
dump(
_pickle.PicklingError: Can't pickle <class 'wtforms.form.Meta'>: attribute lookup Meta on wtforms.form failed
The issue appeared after enabling Oauth2 authentication. I've tried using different version but no luck.
Pgadmin is running in Kubernetes.
Please try setting
PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION = False in configuration file according to your operating system as mentioned here.

DRF - Getting 'NoneType object is not callable' error on delete instance from ModelViewSet

I am getting TypeError, when I try to delete Warehouse instance.
Note: If I delete Shop instance, Warehouse under that Shop needs be deleted, that's why I used on_delete=models.CASCADE.
class Warehouse(models.Model):
"""Warehouse model"""
name = models.CharField(max_length=255)
shop = models.ForeignKey(Shop, on_delete=models.CASCADE)
class WarehouseViewSet(viewsets.ModelViewSet):
"""Viewset"""
queryset = models.Warehouse.objects.all()
serializer_class = serializers.WarehouseSerializer
Error:
TypeError: 'NoneType' object is not callable
[14/Feb/2021 22:10:46] "DELETE /api/v1/shop/warehouse/2/ HTTP/1.1" 500 113266
Internal Server Error: /api/v1/shop/warehouse/2/
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python38\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 476, in raise_uncaught_exception
raise exc
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\mixins.py", line 91, in destroy
self.perform_destroy(instance)
File "C:\Python38\lib\site-packages\rest_framework\mixins.py", line 95, in perform_destroy
instance.delete()
File "C:\Python38\lib\site-packages\django\db\models\base.py", line 921, in delete
collector.collect([self], keep_parents=keep_parents)
File "C:\Python38\lib\site-packages\django\db\models\deletion.py", line 224, in collect
field.remote_field.on_delete(self, field, sub_objs, self.using)
Found the solution. I did not handle on_delete for Children model.
SOLUTION
class WarehouseChildren(models.Model):
data = models.PositiveIntegerField(default=0)
warehouse = models.ForeignKey(Warehouse, on_delete=models.SET_NULL, null=True)
or
class WarehouseChildren(models.Model):
data = models.PositiveIntegerField(default=0)
warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE)