pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.7k stars 1.7k forks source link

SES Mail Driver not working #4124

Closed ghost closed 2 years ago

ghost commented 2 years ago

Current Behavior

When setting the mail driver to 'ses' in .env, this error is found in the failed_jobs table whenever Pterodactyl attempts to send out an email:

Aws\Exception\CredentialsException: Error retrieving credentials from the instance profile metadata service. (Client error: `GET http://169.254.169.254/latest/meta-data/iam/security-credentials/` resulted in a `404 Not Found` response:
404 Not Found

The resource could not be found.

) in /var/www/pterodactyl/vendor/aws/aws-sdk-php/src/Credentials/InstanceProfileProvider.php:242
Stack trace:
#0 /var/www/pterodactyl/vendor/aws/aws-sdk-php/src/Credentials/InstanceProfileProvider.php(134): Aws\Credentials\InstanceProfileProvider->handleRetryableException()
#1 [internal function]: Aws\Credentials\InstanceProfileProvider->Aws\Credentials\{closure}()
#2 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Coroutine.php(160): Generator->throw()
#3 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Promise\Coroutine->_handleFailure()
#4 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#5 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#6 /var/www/pterodactyl/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()
#7 /var/www/pterodactyl/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()
#8 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute()
#9 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#10 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#12 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#13 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Coroutine.php(67): GuzzleHttp\Promise\Promise->wait()
#14 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\Coroutine->GuzzleHttp\Promise\{closure}()
#15 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#16 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#17 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Coroutine.php(103): GuzzleHttp\Promise\Promise->wait()
#18 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(274): GuzzleHttp\Promise\Coroutine->wait()
#19 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#20 /var/www/pterodactyl/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#21 /var/www/pterodactyl/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#22 /var/www/pterodactyl/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\AwsClient->execute()
#23 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php(49): Aws\AwsClient->__call()
#24 /var/www/pterodactyl/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(71): Illuminate\Mail\Transport\SesTransport->send()
#25 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(521): Swift_Mailer->send()
#26 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(288): Illuminate\Mail\Mailer->sendSwiftMessage()
#27 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php(65): Illuminate\Mail\Mailer->send()
#28 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): Illuminate\Notifications\Channels\MailChannel->send()
#29 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(106): Illuminate\Notifications\NotificationSender->sendToNotifiable()
#30 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\Notifications\NotificationSender->Illuminate\Notifications\{closure}()
#31 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(109): Illuminate\Notifications\NotificationSender->withLocale()
#32 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(54): Illuminate\Notifications\NotificationSender->sendNow()
#33 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php(104): Illuminate\Notifications\ChannelManager->sendNow()
#34 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Notifications\SendQueuedNotifications->handle()
#35 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#36 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#37 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#38 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#39 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#40 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#41 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#42 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#43 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()
#44 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#45 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#46 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#47 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#48 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#49 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#50 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#51 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()
#52 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon()
#53 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()
#54 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#55 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#56 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#57 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#58 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#59 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#60 /var/www/pterodactyl/vendor/symfony/console/Command/Command.php(299): Illuminate\Console\Command->execute()
#61 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#62 /var/www/pterodactyl/vendor/symfony/console/Application.php(978): Illuminate\Console\Command->run()
#63 /var/www/pterodactyl/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand()
#64 /var/www/pterodactyl/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()
#65 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\Component\Console\Application->run()
#66 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#67 /var/www/pterodactyl/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#68 {main}

I haven't had time to upgrade the panel yet, however, I see no changelogs pertaining to SES, so I don't believe upgrading would change this result.

Expected Behavior

SES mail driver should work

Steps to Reproduce

N/A

Panel Version

1.7.0

Wings Version

1.5.1

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

ghost commented 2 years ago

Apologies. I realize this is an issue in the aws-php-sdk package and not Pterodactyl.

Can I only use the SES driver if my panel is on an EC2 node? Am I better off using the SMTP driver and configuring it to use SES?

DaneEveritt commented 2 years ago

You need to provide a SES_KEY and SES_SECRET environment variable to use the proper AWS keys. It looks like it is bugged right now though and hard-coded to us-east-1, you can try editing config/services.php to use the expected region as well.

ghost commented 2 years ago

Thanks, Dane! It's working great now. :)