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

BadMethodCallException when calling chunk #189

Closed
sahilsharma011 opened this issue Feb 25, 2019 · 6 comments
Closed

BadMethodCallException when calling chunk #189

sahilsharma011 opened this issue Feb 25, 2019 · 6 comments

Comments

@sahilsharma011
Copy link
Contributor

Describe the bug

I am receiving [BadMethodCallException] Method isNotEmpty does not exist whenever I am using chunk method on a DynamoDbModel.
I am receiving this error on all my servers (testing, staging and production) but not on my local machine even though all 4 machines have same versions of php, laravel and laravel-dynamodb.

Stacktrace

[2019-02-25 11:51:04] staging.ERROR: BadMethodCallException: Method isNotEmpty does not exist. in /api/bootstrap/cache/compiled.php:6366
Stack trace:
#0 /api/vendor/baopham/dynamodb/src/DynamoDbQueryBuilder.php(430): Illuminate\Support\Collection->__call('isNotEmpty', Array)
#1 /api/app/Console/Commands/IndexInvoicesToElastic.php(142): BaoPham\DynamoDb\DynamoDbQueryBuilder->chunk(10000, Object(Closure))
#2 [internal function]: App\Console\Commands\IndexInvoicesToElastic->handle()
#3 /api/bootstrap/cache/compiled.php(1257): call_user_func_array(Array, Array)
#4 /api/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#5 /api/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /api/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /api/vendor/symfony/console/Application.php(794): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /api/vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Commands\IndexInvoicesToElastic), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /api/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /api/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 {main}

Version info

  • Laravel: 5.2
  • laravel-dynamodb: 4.11.2
@baopham
Copy link
Owner

baopham commented Feb 25, 2019

Darn, it's because laravel 5.2 Collection doesn't have isNotEmpty method. You could upgrade laravel to 5.3 or you can manually update the code in

if ($results->isNotEmpty()) {
to if (!$results->isEmpty())

@sahilsharma011
Copy link
Contributor Author

I can't update my laravel version right now.
Yes I can change that file but it just feels dirty changing a file in vendor directory. Can we maybe do this in a pull request so that people using laravel 5.2 don't face this bug?

@baopham
Copy link
Owner

baopham commented Feb 25, 2019

Thanks for the PR

@baopham baopham closed this as completed Feb 25, 2019
@sahilsharma011
Copy link
Contributor Author

@baopham can you please publish a release so that I can update my project

@baopham
Copy link
Owner

baopham commented Feb 26, 2019

hey @sahilsharma011, are you able to use dev-master for now? I would like to have the tests all fixed first before we release it.

@sahilsharma011
Copy link
Contributor Author

sahilsharma011 commented Feb 26, 2019 via email

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

2 participants