Symfony messenger install for mailer: PHP Warning: PHP Startup: Unable to load dynamic library 'amqp.so' - symfony

When I run composer require symfony/mailer
I have this screen:
If you want to send emails asynchronously:
1. Install the messenger component by running composer require messenger;
2. Add 'Symfony\Component\Mailer\Messenger\SendEmailMessage': amqp to the
config/packages/messenger.yaml file under framework.messenger.routing
and replace amqp with your transport name of choice.
I run composer require messenger
My config/packages/messenger.yaml:
framework:
messenger:
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
use_notify: true
check_delayed_interval: 60000
retry_strategy:
max_retries: 3
multiplier: 2
failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
#Symfony\Component\Mailer\Messenger\SendEmailMessage: async
Symfony\Component\Mailer\Messenger\SendEmailMessage: amqp
Symfony\Component\Notifier\Message\ChatMessage: async
Symfony\Component\Notifier\Message\SmsMessage: async
# Route your messages to the transports
#'App\Message\YourMessage': async
I have now :
PHP Warning: PHP Startup: Unable to load dynamic library 'amqp.so'
(tried: /usr/lib/php/20200930/amqp.so (/usr/lib/php/20200930/amqp.so:
cannot open shared object file: No such file or directory),
/usr/lib/php/20200930/amqp.so.so (/usr/lib/php/20200930/amqp.so.so:
cannot open shared object file: No such file or directory)) in Unknown on line 0
I tried to install amqp library and I can't use phpize,
I tried to install php-dev and many others, it crashed in all...

I ran sudo apt install php8.1-amqp
and add new error
--show-private options doesn't exist
It be a Bug for VSCode that I 've resolved by change --show-private by --show-hidden in ~/.vscode/extensions/thenouillet.symfony-vscode-1.0.2/out/symfony/provider/ConsoleContainerProvider.js

I don't have error in the VSCode console but I have this one in my deBug Bar of Symfony:
Invalid Messenger routing configuration: the "Symfony\Component\Mailer\Messenger\SendEmailMessage" class is being routed to a sender called "amqp". This is not a valid transport or service id.

Related

Command "symfony console messenger:failed:show" not working

I am working the Symfony Fast Track Chapter 18.3
Configuring the Messenger Configuration (config/packages/messenger.yaml):
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
# failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
auto_setup: false
use_notify: true
check_delayed_interval: 60000
retry_strategy:
max_retries: 3
multiplier: 2
failed:
dsn: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
# Route your messages to the transports
# 'App\Message\YourMessage': async
App\Message\CommentMessage: async
The Messenger daemon is started
But when I run the following command I get the error Message below:
jpmena#jpmena-300E4A-300E5A-300E7A-3430EA-3530EA:~/CONSULTANT/FASTTRACK/DEV/guestbook$ symfony console messenger:failed:show
There are no commands defined in the "messenger:failed" namespace.
Did you mean this?
messenger
What is wrong in my configuration?
I think your forget to remove comment on "failure_transport" line
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
failure_transport: failed <-- remove comment here

SSL error when creating vue.js app using api platform client generator

I tried to create client app of my API created using API Platform. I follow this guide https://api-platform.com/docs/client-generator/vuejs/.
I use Laravel Homestead for the VM when developing it.
I've added myapp .crt file to Keychan Access.
Problem was, when I try to execute
generate-api-platform-client --generator vue https://myapp-api.local/api src/
It return error message like this:
{
api: Api { entrypoint: 'https://myapp-api.local/api', resources: [] },
error: FetchError: request to https://myapp-api.local/api failed, reason: unable to verify the first certificate
at ClientRequest.<anonymous> (/Users/permana.jayanta/.config/yarn/global/node_modules/node-fetch/index.js:133:11)
at ClientRequest.emit (events.js:209:13)
at TLSSocket.socketErrorListener (_http_client.js:406:9)
at TLSSocket.emit (events.js:209:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
name: 'FetchError',
message: 'request to https://myapp-api.local/api failed, reason: unable to verify the first certificate',
type: 'system',
errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
},
response: undefined,
status: undefined
}
I'm thinking this is related with SSL certificate. That node doesn't recognise the certificate. How to make node.js recognise the custom SSL certificate generated by Homestead?
it failed to verify https signature.
To disable it, type in shell
export NODE_TLS_REJECT_UNAUTHORIZED=0

Redis connection (in Doctrine cache) gets initialized on each command

I have a Symfony 4.1 app, where I use Doctrine and want to setup Redis cache for Doctrine.
Here is a part of composer.json
"snc/redis-bundle": "^2.1",
"symfony/doctrine-bridge": "^4.1",
"symfony/proxy-manager-bridge": "^4.1",
Here is yml config file:
snc_redis:
clients:
doctrine_cache:
type: phpredis
alias: doctrine_cache
dsn: '%my_dsn%'
doctrine:
metadata_cache:
client: doctrine_cache
entity_manager: default
The problem is: on the very first time when Symfony tries to generate cache for all DI containers, it initializes Redis connection. This means for example when I run any console command, it tries to connect to redis. Example:
// very first command after git clone and composer install
php bin/console about
Output:
In PhpredisClientFactory.php line 64:
php_network_getaddresses: getaddrinfo failed: No such host is known.
I expect that Redis cache service will be initialized lazily, otherwise I cannot run other build commands on independent (non having Redis) environment.
Can someone advise please?
If this happens after composer install then you might have composer run the default commands:
- "post-install-cmd"
- "post-update-cmd"
Try to remove them and add see if the Redis works... If it works then add a script to your deployment entrypoint to run them at the end.
PS: pay attention to doctrine and Redis if you are using migrations: then you should also clear doctrine cache.

Cloudify blueprint upload import error

we have an openstack deployment. We chose to deploy cloudify manager by image option. Now we are using the paid version of the manager image. When we tried to upload a openstack blueprint from the CLI:
cfy blueprints upload -b vm -p cloudify-nodecellar-example-master/openstack-blueprint.yaml
we have the next output error on the cloudify manager:
20/12/2017 11:45:21 [INFO] [manager_rest.server] InvalidBlueprintError: Invalid blueprint - Failed to resolve the following urls: {u'file:///opt/manager/resources/spec/cloudify/4.3.dev1/types.yaml': "Import failed: Unable to open import url file:///opt/manager/resources/spec/cloudify/4.3.dev1/types.yaml; "}. In addition, failed to resolve the original import url - Import failed: Unable to open import url http://www.getcloudify.org/spec/cloudify/4.3.dev1/types.yaml; HTTPConnectionPool(host='www.getcloudify.org', port=80): Max retries exceeded with url: /spec/cloudify/4.3.dev1/types.yaml (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
in: /opt/manager/resources/openstack-blueprint-b03206ec-1bde-4595-8cc0-93de5510f777/openstack-blueprint.yaml
in line: 7, column: 0
path: imports
value: ['http://www.getcloudify.org/spec/cloudify/4.3.dev1/types.yaml', 'http://www.getcloudify.org/spec/openstack-plugin/2.0.1/plugin.yaml', 'http://www.getcloudify.org/spec/diamond-plugin/1.3.6/plugin.yaml', 'types/nodecellar.yaml', 'types/openstack-types.yaml']
20/12/2017 11:45:23 [INFO] [manager_rest.server] Authenticated user:
It seems like there are a few issues, which I will not go through here. The best way to get started is to follow the step-by-step instructions at this link.
If you have any further questions, please feel free to ask them here or in our user group.

~/.ssh/id_rsa.pub not found error while installing capistrano as ansible playbook

I try to install https://github.com/roots/bedrock-ansible to get a bedrock deployment (http://roots.io/wordpress-stack/) running.
When I run "vagrant up", after some time I get the error:
TASK: [capistrano-setup | Setup deploy group] *********************************
skipping: [default]
TASK: [capistrano-setup | Setup deploy user] **********************************
skipping: [default]
TASK: [capistrano-setup | Adding public key to server] ************************
fatal: [default] => could not locate file in lookup: ~/.ssh/id_rsa.pub
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit #/Users/johannes/site.retry
default : ok=46 changed=16 unreachable=1 failed=0
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
I do not have a clou how i can fix this. Do you have an idea?
It seems the role is trying to find your local public key. It should be in the location in the error message '~/.ssh/id_rsa.pub', but it's not. So either you don't have one, or you keep it in another location.
If you're not familiar with generating SSH keys you probably don't have one. I personally like the GitHub help page for this: https://help.github.com/articles/generating-ssh-keys/
(you only have to perform steps 1 and 2).
If you do have SSH keys, but in a different location, the capistrano-install role in bedrock uses some variables:
deploy_user: deploy
deploy_keys:
- "~/.ssh/id_rsa.pub"
So you can set (multiple) public key files in the deploy_keys list and they will be added to the deploy_user's authorized keys.
All this is needed because Capistrano will use the deploy user to connect to the remote server later. http://blakesmith.me/2010/02/08/understanding-public-key-private-key-concepts.html

Resources