Closed mangelsnc closed 7 years ago
Can you show the stacktrace?
Hi @norkunas,
I think the problem is not yours, but "guzzlehttp/guzzle": "~5.3"
dependency and some subdependencies of this (this is about v0.1 of your library).
You can read more about this here. It's a bit outdated but I think is not solved on guzzle-adapter-5
.
I hope you release soon the v1 with the guzzle-adapter-6
, I think this will be solved with this.
@mangelsnc so you're using php-http/guzzle5-adapter ?
Yes, it's an old project in Symfony which uses this library, I had the same problem with the MailgunBundle in this project.
I see that "php-http/discovery": "^1.0" is defined in MailgunBundle composer.json file, but onesignal-php-api does not depend and doesn't do any automatic discovery so you must provide the adapter that you use for http. Also do we talk about v0.1 branch or v1? Because in v0.1 there is a hard dependency on guzzle5 (which doesn't have dependency on puli discovery) and in v1 you can use any http client implementation
This is about v0.1 branch.
So this lib in any means doesn't depend on puli factory. Please show stacktrace for further investigation
OK,
Give me some time, finally I make the notification manually to let this working.
I'll try to reproduce the error again, but I think it's a version conflict amongst several libraries.
This was my composer.json
when the bug happens. It fails when I use the add
method of Notification
.
{
"name": "mangelsnc/uac",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"jms/serializer-bundle": "^1.1",
"doctrine/doctrine-migrations-bundle": "^1.1",
"stof/doctrine-extensions-bundle": "^1.2",
"javiereguiluz/easyadmin-bundle": "^1.12",
"vich/uploader-bundle": "^1.0",
"norkunas/onesignal-php-api": "dev-master",
"guzzlehttp/psr7": "^1.2",
"php-http/guzzle5-adapter": "^0.5.0",
"cspoo/swiftmailer-mailgun-bundle": "^0.2.1",
"nelmio/api-doc-bundle": "^2.12"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"fzaninotto/faker": "^1.6"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"platform": {
"php": "5.5.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
}
And this is the method I used in a Symfony service called on a command:
public function sendNotification(Event $event)
{
$playersIds = $event->getSubscriptionsIds();
$this->api->notifications->add([
'contents' => [
'en' => 'Notification message'
],
'included_players_ids' => $playersIds,
'data' => $event->toArray(),
]));
}
Let me run again these version and I'll print you the stacktrace.
Note: In the moment I have the error the composer.lock
was looks like this. I put it on Pastebin to maintain this post readable.
When I try to send a notifications this error is shown as a Runtime Exception.
Any idea about it?