Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method Symfony\Component\HttpFoundation\Response::create() when adding webhook in facebook. #122

Open
NowakAdmin opened this issue Jun 25, 2022 · 2 comments

Comments

@NowakAdmin
Copy link

NowakAdmin commented Jun 25, 2022

  • BotMan Version: 2.6.1
  • PHP Version: 8.1
  • Messaging Service(s): Facebook
  • Cache Driver: LaravelCache

Description:

Hi, im geting this error in laravel 9, how to handle it easiest way?

method create not exist, so should i make new class that extends Request with method create ?

I already tried to change all references from use Symfony\Component\HttpFoundation\Response;
to Illuminate\Http\Response (and Request) but this also not work.

curl -X GET "https://mydomain.com/botman?hub.verify_token=MySecretTokenFromDotENV&hub.challenge=CHALLENGE_ACCEPTED&hub.mode=subscribe"

Reponse:

Error: Call to undefined method Symfony\Component\HttpFoundation\Response::create() in file /var/www/nams/botman/driver-facebook/src/FacebookDriver.php on line 120

#0 /var/www/nams/botman/botman/src/Drivers/DriverManager.php(157): BotMan\Drivers\Facebook\FacebookDriver->verifyRequest()
#1 /var/www/nams/botman/botman/src/BotMan.php(542): BotMan\BotMan\Drivers\DriverManager::verifyServices()
#2 /var/www/nams/botman/botman/src/BotMan.php(421): BotMan\BotMan\BotMan->verifyServices()
#3 /var/www/nams/app/Http/Controllers/BotManController.php(40): BotMan\BotMan\BotMan->listen()
#4 /var/www/nams/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\BotManController->handle()...

Steps To Reproduce:

Install botman on laravel 9 from local repository (path)
change in composer/json dependencies to fit laravel 9
Try to connect to facebook like:

        $config = [
            'user_cache_time' => 720,

            'config' => [
                'conversation_cache_time' => 720 ,
            ],
            // Your driver-specific configuration
            'facebook' => [
                'token' => env('FACEBOOK_TOKEN'),
                'app_secret' => env('FACEBOOK_APP_SECRET'),
                'verification' => env('FACEBOOK_VERIFICATION'),
            ]
        ];
        $botman = app('botman');
        DriverManager::loadDriver(\BotMan\Drivers\Facebook\FacebookDriver::class);
        BotManFactory::create($config, new LaravelCache());
        $botman->listen();

try to get response for facebook by:
curl -X GET "https://mydomain.com/botman?hub.verify_token=MySecretTokenFromDotENV&hub.challenge=CHALLENGE_ACCEPTED&hub.mode=subscribe"

@donmbelembe
Copy link

hello, did you manage to find solution ?

donmbelembe added a commit to donmbelembe/driver-facebook that referenced this issue Dec 17, 2022
donmbelembe added a commit to donmbelembe/driver-facebook that referenced this issue Dec 17, 2022
Response::create method was deprecated on symfony/http-foundation v6
@gocebonev
Copy link

gocebonev commented Apr 18, 2023

There are 2 options:

  1. Downgrade to http-foundation 5.x if possible composer require symfony/http-foundation "^5.4"
  2. Fork the package and make the changes suggested by @donmbelembe till the package is updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants