auth0 / laravel-auth0

Laravel SDK for Auth0 Authentication and Management APIs.
MIT License
247 stars 136 forks source link

Argument 1 passed to Auth0\Login\Auth0Service::__construct() must be of the type array, null given, called in /var/www/vendor/auth0/login/src/Auth0/Login/LoginServiceProvider.php on line 68 #224

Closed Bunlong closed 3 years ago

Bunlong commented 3 years ago

SDK Version

6.4.0

PHP Version

PHP 7.3

Composer Version

2.x

What happened?

When I try to install auth0/login using composer:

$ docker-compose exec app composer require auth0/login

I got following error:

#34 /var/www/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#35 {main}
"} 

   TypeError 

  Argument 1 passed to Auth0\Login\Auth0Service::__construct() must be of the type array, null given, called in /var/www/vendor/auth0/login/src/Auth0/Login/LoginServiceProvider.php on line 68

  at vendor/auth0/login/src/Auth0/Login/Auth0Service.php:45
    41|      * @param CacheInterface|null $cache
    42|      *
    43|      * @throws \Illuminate\Contracts\Container\BindingResolutionException
    44|      */
  > 45|     public function __construct(
    46|         array $auth0Config,
    47|         StoreInterface $store = null,
    48|         CacheInterface $cache = null
    49|     )

      +34 vendor frames 
  35  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan ide-helper:generate handling the post-update-cmd event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

How can we reproduce this issue?

When I try to install auth0/login using composer:

$ docker-compose exec app composer require auth0/login

Additional context

No response

evansims commented 3 years ago

Hi @Bunlong 👋 Sorry to hear you're hitting an issue on this. I tried this locally on a clean Laravel project and I'm unable to reproduce it here.

Bunlong commented 3 years ago

@evansims

The output from running composer show -i

You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
auth0/auth0-php                    7.9.2     Auth0 PHP SDK.
auth0/login                        6.4.0     Laravel plugin that helps authenticate with the Auth0 service
auth0/php-jwt                      3.3.4     A simple library to work with JSON Web Token and JSON Web Signature
barryvdh/laravel-ide-helper        v2.8.2    Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.
barryvdh/reflection-docblock       v2.0.6   
beyondcode/laravel-dump-server     1.7.0     Symfony Var-Dump Server for Laravel
brick/math                         0.9.3     Arbitrary-precision arithmetic library
clue/stdio-react                   v2.4.0    Async, event-driven console input & output (STDIN, STDOUT) for truly interactive CLI applications, built on top of ReactPHP
clue/stream-filter                 v1.5.0    A simple and modern approach to stream filtering in PHP
clue/term-react                    v1.3.0    Streaming terminal emulator, built on top of ReactPHP.
clue/utf8-react                    v1.2.0    Streaming UTF-8 parser, built on top of ReactPHP.
composer/ca-bundle                 1.2.10    Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/composer                  2.1.6     Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.
composer/metadata-minifier         1.0.0     Small utility library that handles metadata minification and expansion.
composer/semver                    3.2.5     Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses             1.5.5     SPDX licenses list and validation library.
composer/xdebug-handler            2.0.2     Restarts a process without Xdebug.
doctrine/annotations               1.13.2    Docblock Annotations Parser
doctrine/cache                     2.1.1     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/dbal                      2.13.3    Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations              v0.5.3    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/event-manager             1.1.1     The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                 2.0.3     PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator              1.4.0     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                     1.2.1     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression      v2.3.1    CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator            2.1.25    A library for validating emails against several RFCs
evenement/evenement                v3.0.1    Événement is a very simple event dispatching library for PHP
facade/ignition-contracts          1.0.2     Solution contracts for Ignition
fideloper/proxy                    4.4.1     Set trusted proxies for Laravel
filp/whoops                        2.14.1    php error handling for cool kids
firebase/php-jwt                   v5.4.0    A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
friendsofphp/php-cs-fixer          v2.19.2   A tool to automatically fix PHP code style
fzaninotto/faker                   v1.9.2    Faker is a PHP library that generates fake data for you.
google/apiclient                   v2.10.1   Client library for Google APIs
google/apiclient-services          v0.212.0  Client library for Google APIs
google/auth                        v1.18.0   Google Auth Library for PHP
graham-campbell/github             v8.9.1    GitHub Is A GitHub Bridge For Laravel
graham-campbell/manager            v4.6.0    Manager Provides Some Manager Functionality For Laravel
guzzlehttp/guzzle                  6.5.5     Guzzle is a PHP HTTP client library
guzzlehttp/promises                1.4.1     Guzzle promises library
guzzlehttp/psr7                    1.8.2     PSR-7 message implementation that also provides common utility methods
hamcrest/hamcrest-php              v2.0.1    This is the PHP port of Hamcrest Matchers
jolicode/jolinotif                 v2.3.0    Send desktop notifications on Windows, Linux, MacOS.
justinrainbow/json-schema          5.2.11    A library to validate a json schema.
knplabs/github-api                 v2.15.0   GitHub API v3 client
laravel/framework                  v7.30.4   The Laravel Framework.
laravel/socialite                  v4.4.1    Laravel wrapper around OAuth 1 & OAuth 2 libraries.
laravel/tinker                     v2.6.1    Powerful REPL for the Laravel framework.
laravel/ui                         v2.5.0    Laravel UI utilities and presets.
lcobucci/jwt                       3.3.3     A simple library to work with JSON Web Token and JSON Web Signature
league/commonmark                  1.6.6     Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)
league/flysystem                   1.1.5     Filesystem abstraction: Many filesystems, one API.
league/mime-type-detection         1.7.0     Mime-type detection for Flysystem
league/oauth1-client               v1.10.0   OAuth 1.0 Client Library
mockery/mockery                    1.4.4     Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                    2.3.2     Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                  1.10.2    Create deep copies (clones) of your objects
namshi/jose                        7.2.3     JSON Object Signing and Encryption library for PHP.
nesbot/carbon                      2.53.1    An API extension for DateTime that supports 281 different languages.
nikic/php-parser                   v4.12.0   A PHP parser written in PHP
nunomaduro/collision               v4.3.0    Cli error handling for console/command-line PHP applications.
nunomaduro/larastan                v0.6.13   Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel
opis/closure                       3.6.2     A library that can be used to serialize closures (anonymous functions) and arbitrary objects.
paragonie/constant_time_encoding   v2.4.0    Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
paragonie/random_compat            v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                   2.0.3     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.1.0     Library for handling version information and constraints
php-cs-fixer/diff                  v1.3.1    sebastian/diff v2 backport support for PHP5.6
php-http/cache-plugin              1.7.2     PSR-6 Cache plugin for HTTPlug
php-http/client-common             2.4.0     Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                 1.14.0    Finds installed HTTPlug implementations and PSR-7 message factories
php-http/guzzle6-adapter           v2.0.2    Guzzle 6 HTTP Adapter
php-http/httplug                   2.2.0     HTTPlug, the HTTP client abstraction for PHP
php-http/message                   1.12.0    HTTP Message related tools
php-http/message-factory           v1.0.2    Factory interfaces for PSR-7 HTTP Message
php-http/promise                   1.1.0     Promise used for asynchronous HTTP requests
phpdocumentor/reflection-common    2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock  5.2.2     With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver        1.4.0     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpoption/phpoption                1.8.0     Option Type for PHP
phpseclib/phpseclib                3.0.10    PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
phpspec/prophecy                   1.14.0    Highly opinionated mocking framework for PHP 5.3+
phpstan/phpstan                    0.12.99   PHPStan - PHP Static Analysis Tool
phpunit/php-code-coverage          9.2.6     Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          3.0.5     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                3.1.1     Invoke callables with a timeout
phpunit/php-text-template          2.0.4     Simple template engine.
phpunit/php-timer                  5.0.3     Utility class for timing
phpunit/phpunit                    9.5.9     The PHP Unit Testing framework.
psr/cache                          1.0.1     Common interface for caching libraries
psr/container                      1.1.1     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0     Standard interfaces for event handling.
psr/http-client                    1.0.1     Common interface for HTTP clients
psr/http-factory                   1.0.1     Common interfaces for PSR-7 HTTP message factories
psr/http-message                   1.0.1     Common interface for HTTP messages
psr/log                            1.1.4     Common interface for logging libraries
psr/simple-cache                   1.0.1     Common interfaces for simple caching
psy/psysh                          v0.10.8   An interactive shell for modern PHP.
ralouphie/getallheaders            3.0.3     A polyfill for getallheaders.
ramsey/collection                  1.2.1     A PHP library for representing and manipulating collections.
ramsey/uuid                        4.2.1     A PHP library for generating and working with universally unique identifiers (UUIDs).
react/event-loop                   v1.2.0    ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/promise                      v2.8.0    A lightweight implementation of CommonJS Promises/A for PHP
react/stream                       v1.2.0    Event-driven readable and writable streams for non-blocking I/O in ReactPHP
sebastian/cli-parser               1.0.1     Library for parsing CLI options
sebastian/code-unit                1.0.8     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator               4.0.6     Provides the functionality to compare PHP values for equality
sebastian/complexity               2.0.2     Library for calculating the complexity of PHP code units
sebastian/diff                     4.0.4     Diff implementation
sebastian/environment              5.1.3     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 4.0.3     Provides the functionality to export PHP variables for visualization
sebastian/global-state             5.0.3     Snapshotting of global state
sebastian/lines-of-code            1.0.3     Library for counting the lines of code in PHP source code
sebastian/object-enumerator        4.0.4     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         2.0.4     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        4.0.4     Provides functionality to recursively process PHP variables
sebastian/resource-operations      3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                     2.3.4     Collection of value objects that represent the types of the PHP type system
sebastian/version                  3.0.2     Library that helps with managing the version number of Git-hosted PHP projects
seld/jsonlint                      1.8.3     JSON Linter
seld/phar-utils                    1.1.2     PHAR file format utilities, for when PHP phars you up
spatie/phpunit-watcher             1.23.2    Automatically rerun PHPUnit tests when source code changes
swiftmailer/swiftmailer            v6.2.7    Swiftmailer, free feature-rich PHP mailer
symfony/cache                      v5.3.7    Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/console                    v5.3.7    Eases the creation of beautiful and testable command line interfaces
symfony/contracts                  v2.4.0    A set of abstractions extracted out of the Symfony components
symfony/css-selector               v5.3.4    Converts CSS selectors to XPath expressions
symfony/error-handler              v5.3.7    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v5.3.7    Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/filesystem                 v5.3.4    Provides basic utilities for the filesystem
symfony/finder                     v5.3.7    Finds files and directories via an intuitive fluent interface
symfony/http-foundation            v5.3.7    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v5.3.7    Provides a structured process for converting a Request into a Response
symfony/mime                       v5.3.7    Allows manipulating MIME messages
symfony/options-resolver           v5.3.7    Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype             v1.23.0   Symfony polyfill for ctype functions
symfony/polyfill-iconv             v1.23.0   Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme     v1.23.1   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn          v1.23.0   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.23.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.23.1   Symfony polyfill for the Mbstring extension
symfony/polyfill-php56             v1.20.0   Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70             v1.20.0   Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72             v1.23.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.23.0   Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.23.1   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.23.0   Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process                    v5.3.7    Executes commands in sub-processes
symfony/routing                    v5.3.7    Maps an HTTP request to a set of configuration variables
symfony/stopwatch                  v5.3.4    Provides a way to profile code
symfony/string                     v5.3.7    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                v5.3.7    Provides tools to internationalize your application
symfony/var-dumper                 v5.3.7    Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v5.3.7    Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                       v5.3.6    Loads and dumps YAML files
theseer/tokenizer                  1.2.1     A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles  2.2.3     CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sendi...
tymon/jwt-auth                     1.0.2     JSON Web Token Authentication for Laravel and Lumen
vlucas/phpdotenv                   v4.2.0    Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                1.5.6     Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                   1.10.0    Assertions to validate method input/output with nice error messages.
yosymfony/resource-watcher         v2.0.1    A simple resource watcher using Symfony Finder
evansims commented 3 years ago

It appears the library did install successfully, then? Are you still seeing an error somewhere with it, now installed? Can you try running composer update to bring auth0/login up to 6.4.1, the latest release? Also, if you had any details on my other question in the previous post, that would be helpful in diagnosing.

Bunlong commented 3 years ago

No, the library has been installed unsuccessfully.

Bunlong commented 3 years ago

@evansims I added the dependency outside my docker container, it throws the same error.

Bunlong commented 3 years ago

@evansims other developers are also hitting this issue Auth0 Laravel API integration: TypeError: Argument 1 passed to Auth0\Login\Auth0Service::__construct() must be of the type array.

evansims commented 3 years ago

As I mentioned, I'm unable to reproduce this locally on a clean project, so there must be some contributing factor here we need to troubleshoot.

Also, it's worth noting that Laravel 7 is end-of-life and no longer supported, We only support actively maintained versions of Laravel. There may be an issue with Laravel 7 rather than Laravel 8 (which is what I am testing against.)

Shonetow commented 3 years ago

It's the ide-helper package that generates this error. I solved this by adding this line of code inside the LoginServiceProvider.php file, at the beginning of the register() method:

$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'laravel-auth0');

Also, if you rename the config.php file into laravel-auht0.php may save the problem too?

evansims commented 3 years ago

Thanks very much, @Shonetow! I really appreciate you sharing your findings on that.

Oddly I'd never seen this particular bug reported before, and I'm sorry to hear others were hitting this as well unbeknownst! Glad you found a solution that worked, and hopefully this will help others work around that in the future. 👍

Bunlong commented 3 years ago

@evansims @Shonetow, that's kind of hard coding. Could you please fix it in the next version?

evansims commented 3 years ago

@Bunlong This appears to be a bug in the ide-helper library, rather than this library. I've not encountered this error myself, but the problem is a result of the behavior of that library, not due to anything being handled incorrectly in this one.