Skip to content

bug: infrahubctl info returns a GraphQL error when user is not authenticated #398

@wvandeun

Description

@wvandeun

Component

No response

Infrahub SDK version

1.12.0

Current Behavior

Executing the infrahubctl info command, without providing authentication details will result in a GraphQL error:

infrahubctl info
 Address:            http://localhost:8000                                                                                    
 Connection Status:  ❌                                                                                                       
 Connection Error:   An error occurred while executing the GraphQL Query                                                      
                     query GET_PROFILE_DETAILS {                                                                              
                       AccountProfile {                                                                                       
                         id                                                                                                   
                         display_label                                                                                        
                         account_type {                                                                                       
                           value                                                                                              
                           __typename                                                                                         
                           updated_at                                                                                         
                         }                                                                                                    
                         status {                                                                                             
                           label                                                                                              
                           value                                                                                              
                           updated_at                                                                                         
                           __typename                                                                                         
                         }                                                                                                    
                         description {                                                                                        
                           value                                                                                              
                           updated_at                                                                                         
                           __typename                                                                                         
                         }                                                                                                    
                         label {                                                                                              
                           value                                                                                              
                           updated_at                                                                                         
                           __typename                                                                                         
                         }                                                                                                    
                         member_of_groups {                                                                                   
                           count                                                                                              
                           edges {                                                                                            
                             node {                                                                                           
                               display_label                                                                                  
                               group_type {                                                                                   
                                 value                                                                                        
                               }                                                                                              
                               ... on CoreAccountGroup {                                                                      
                                 id                                                                                           
                                 roles {                                                                                      
                                   count                                                                                      
                                   edges {                                                                                    
                                     node {                                                                                   
                                       permissions {                                                                          
                                         count                                                                                
                                         edges {                                                                              
                                           node {                                                                             
                                             display_label                                                                    
                                             identifier {                                                                     
                                               value                                                                          
                                             }                                                                                
                                           }                                                                                  
                                         }                                                                                    
                                       }                                                                                      
                                     }                                                                                        
                                   }                                                                                          
                                 }                                                                                            
                                 display_label                                                                                
                               }                                                                                              
                             }                                                                                                
                           }                                                                                                  
                         }                                                                                                    
                         __typename                                                                                           
                         name {                                                                                               
                           value                                                                                              
                           updated_at                                                                                         
                           __typename                                                                                         
                         }                                                                                                    
                       }                                                                                                      
                     }                                                                                                        
                     , [{'message': 'Unable to find the node anonymous / CoreGenericAccount in the database.', 'locations':   
                     [{'line': 3, 'column': 3}], 'path': ['AccountProfile']}] (GraphQLError)                                  
 Python Version:     3.11.6                                                                                                   
 SDK Version:        1.12.0                                                                                                   
 Infrahub Version:   1.2.9rc0                                                                                                 

Expected Behavior

We should display a proper informational message of what is going wrong.

Steps to Reproduce

  • Spin up instance of Infrahub
  • Install the SDK including the CTL extra in a virtual environment
  • Do not set INFRAHUB_API_TOKEN or INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables
  • execute the command infrahubctl info

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working as expected

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions