Skip to content

Domain not available to register SSL certificate after app is created #39

@adriantoll

Description

@adriantoll

When using a Bash script to create an app, promote the main domain to primary, and register an SSL certificate for that domain, the certificate registration doesn't work. (See issue #38 for the reason behind the command under "Remove invalid line at end of variable"). This is the script:

# Create the app
app_json_object_raw=$( atomic apps:create "$account_id" "$site_url" "$site_url" )

# Remove invalid line at end of variable
app_json_object=$( sed '/^\[/d' <<< "$app_json_object_raw" )

# Get app id from json object
app_id=$( jq '.[ "id" ]' <<< "$app_json_object" )

# Get domain id from json object
domain_id=$( jq '.[ "aliases" ][ 1 ][ "id" ]' <<< "$app_json_object" )

# Set primary domain
atomic apps:domain:make-primary "$app_id" "$domain_id"

# Register SSL certificate
atomic ssl:le:register "$account_id" "$site_url"

When trying to register the certificate I get this error:

In RequestException.php line 113:
                                                                                                                                           
  Client error: `POST https://mgmt.pagely.com/api/ssl/letsencrypt/register` resulted in a `422 Unprocessable Entity` response:             
  {"status":"ERROR","body":{"domain":{"messages":["Domain(s) starter2.staging.thirdpress.com must be hosted at pagely and  (truncated...)

I also get an error when trying to register the certificate for the domain through the Atomic control panel after that command is run. I presume this is something to do with timing, as if I wait a few minutes then I can issue the certificate through the control panel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions