ukayani / auth0-deploy

A tool for automated deployment of auth0 components
MIT License
2 stars 2 forks source link

When deploy clients, it throws error "Path must be a string. Received undefined" #3

Closed xiananfan closed 7 years ago

xiananfan commented 7 years ago

I am trying to deploy the clients configurations. Followed the basic setup to setup the repository:

clients
    All Applications
        config.json
    API Explorer Client
        config.json
        grants.json
    auth0-deploy-cli-extension
        config.json
        grants.json
    auth0-github-deploy
        config.json
        grants.json
    Default App
        config.json

With the above folder structure, when use the following command:

auth0-deploy client -c <client-id> -s <client-secret-id> -d <domain.auth0.com>

I got the following message:

Path must be a string. Received undefined.
ukayani commented 7 years ago

@xiananfan which folder are you running the command in?

ukayani commented 7 years ago
/components
--/clients
--/resources
--...

You should be running it in the folder that contains the clients folder or you can specify the working directory via cli argument.

xiananfan commented 7 years ago

Hi @ukayani , thank you for looking into it. Yes, I was running the cli in the components folder. When I try to deploy connections and rules, it was working fine. But somehow, the clients don't want to work.

ukayani commented 7 years ago

@xiananfan what error are you seeing for the clients?

ukayani commented 7 years ago

The same one ? Path must be a string?

ukayani commented 7 years ago

Are you able to post the content of a config.json ? for clients?

ukayani commented 7 years ago

Perhaps try to do a single deployment first to debug the issue.

so auth0-deploy client <clientName> ... see if you get the same error

xiananfan commented 7 years ago

Hi @ukayani, I just tried

xf186001@MUSXF186001-209:~/workplace/bamboo-config/components » auth0-deploy client Default\ App -c {client-id} -s {client-secret} -d bamboo.auth0.com
Path must be a string. Received undefined

It seems it is returning the same error.

ukayani commented 7 years ago

Hi @xiananfan, could you please provide the config.json and grants.json for the client which is causing the problem?

I would like to reproduce the problem on my end so i can see what it is.

Also, are you running on windows or a mac/linux environment?

xiananfan commented 7 years ago

Hi @ukayani, the config.json for the "Default App" looks like the following:

{
    "allowed_clients": null,
    "allowed_logout_urls": null,
    "allowed_origins": null,
    "callback_url_template": false,
    "callbacks": null,
    "client_id": "xbdof-iI9cCpXmt_0pP6PbBa6zzhQSI1",
    "config_route": null,
    "custom_login_page_on": false,
    "global": false,
    "grant_types": [
        "implicit",
        "authorization_code",
        "client_credentials",
        "refresh_token"
    ],
    "is_first_party": true,
    "jwt_configuration": {
        "lifetime_in_seconds": "36000",
        "secret_encoded": false
    },
    "name": "Default App",
    "tenant": "bamboo"
}

This is executed on a mac environment.

Also, it seems @bebbi has submitted a merge request to fix the issue above.

ukayani commented 7 years ago

Hi @xiananfan ,

I've merged @bebbi 's changes and released a new version 0.1.16, can you update your version and try again? Let me know if his change fixes your problem, otherwise we can continue to debug it.

@bebbi Thanks for the fix.

Cheers

xiananfan commented 7 years ago

Hi @ukayani,

Thanks for the fast release. I have done a quick test, and the old error no longer shows up.

xf186001@MUSXF186001-209:~/workplace/bamboo-config/components » auth0-deploy client Default\ App -c {client_id} -s {client_secret} -d bamboo.auth0.com                        1 ↵
Updating client: Default App
Payload validation error: 'Additional properties not allowed: tenant,global,config_route,client_id,callback_url_template'.
xf186001@MUSXF186001-209:~/workplace/bamboo-config/components » auth0-deploy client Default\ App -c {client_id} -s {client_secret} -d bamboo.auth0.com                        1 ↵
Updating client: Default App
Payload validation error: 'Expected type array but found type null' on property callbacks (A set of URLs that are valid to call back from Auth0 when authenticating users). (also) Payload validation error: 'Expected type array but found type null' on property allowed_origins (A set of URLs that represents valid origins for CORS). (also) Payload validation error: 'Expected type array but found type null' on property allowed_logout_urls (A set of URLs that are valid to redirect to after logout from Auth0). (also) Payload validation error: 'Expected type array but found type null' on property allowed_clients (Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients). (also) Payload validation error: 'Additional properties not allowed: secret_encoded' on property jwt_configuration (An object that holds settings related to how JWTs are created).

I first removed the "tenant,global,config_route,client_id,callback_url_template" fields from the config.json. Then I encounter the validation error above.

So it seems the tool is complaining the missing fields "callbacks", "allowed_origins", "allowed_logout_urls", "allowed_clients". Add additional field inside the "jwt_configuration" object.

I could provide the above fields in a real client. However, if you notice, I was trying to update the "Default App" client, which was there by default when you create a new tenant in auth0. I was wondering if you could consider allowing the value to not be there as well. Because the value is a direct dump from the management api v2. In other words, missing the value should be valid, and not encounter a validation error.

I understand the above is a different request. So feel free to consider this issue as resolved.

Thank you again for looking into this!

ukayani commented 7 years ago

Hi @xiananfan

Thanks for testing it out. Could you please create a new issue for this error and include your config.json?

I'll try to address it in a separate issue. Thanks