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

[Auth0\SDK\Exception\CoreException] Invalid domain when trying to run unit tests with Codeception 3.1.0 #358

Closed
jmbantay opened this issue Aug 29, 2019 · 3 comments
Milestone

Comments

@jmbantay
Copy link

Description

I am part of a team developing a Yii 2 web app, although I cannot disclose the nature of the web app. We use Auth0 for the log in function.

My current task is to create unit tests for a specific class in the web app. I am using Codeception for this. I created a simple test and tried to run it just to see if everything will go smoothly. My test:

<?php 
class OSSTest extends \Codeception\Test\Unit
{
    /**
     * @var \UnitTester
     */
    protected $tester;
    
    protected function _before()
    {
    }

    protected function _after()
    {
    }

    // tests
    public function testSomeFeature()
    {
        $this->assertTrue(true);

    }
}

When I run the test, i get the following exception:

[Auth0\SDK\Exception\CoreException] Invalid domain
#1  /home/.../vendor/auth0/auth0-php/src/Auth0.php:167
#2  /home/.../config/params.php:7
#3  /home/.../config/test.php:2
#4  /home/.../vendor/symfony/event-dispatcher/EventDispatcher.php:260
#5  /home/.../vendor/symfony/event-dispatcher/EventDispatcher.php:235
#6  /home/.../vendor/symfony/event-dispatcher/EventDispatcher.php:73

What could be the problem? I'm new to Auth0, so any help would be greatly appreciated.

Environment

  • Version of Auth0-PHP used: 5.0.6
  • Version of PHP used: 7.3.8
  • Additional packages or frameworks used that might be relevant: Yii 2 (2.0.25), Codeception 3.1.0
@joshcanhelp
Copy link
Contributor

@jmbantay - It sounds like you're trying to initialize the Auth0 class without a domain key in your configuration. Can you share the code that's doing that initialization? It could be that you have it set to an ENV value but don't have an .env file for your testing suite.

Here's an example of the correct way to initialize that:

https://auth0.com/docs/quickstart/webapp/php#configure-auth0-php-sdk

@joshcanhelp
Copy link
Contributor

No activity

@joshcanhelp joshcanhelp added this to the 5.6.0 milestone Sep 26, 2019
@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants