heroku / platform-api

Ruby HTTP client for the Heroku API
MIT License
214 stars 85 forks source link

Delay on custom domain list status #76

Open kimyu92 opened 7 years ago

kimyu92 commented 7 years ago
platform = PlatformAPI.connect_oauth(key)
hostnames = heroku.domain.list(app_name).map { |x| x['hostname'] }
platform.domain.create(APP_NAME, 'hostname' => "www.sampleDomain.com") unless 

# create domain
hostnames.include? "www.someDomain.com"
=> {"acm_status"=>nil, "app"=>{...}, "cname"=>"www.sampleDomain.com.herokudns.com", "created_at"=>..., "hostname"=>"www.sampleDomain.com", "kind"=>"custom", "status"=>"succeeded", "updated_at"=>....}

# check in the list
platform.domain.list(APP_NAME).map { |x| x['hostname'] }.include? "www.sampleDomain.com"
=> false # any reason?

Sometimes, it took about 15 mins+ for the custom domain to be found in list. Is there a way to tell whether the custom domain will be added to the list? Can I rely on domain.list api? If not, what is the alternative?

mikehale commented 7 years ago

This sounds like a caching issue. We should fix that but in the meantime as a workaround you can disable caching of responses. See https://github.com/heroku/platform-api/issues/15#issuecomment-51499193

kimyu92 commented 7 years ago

@mikehale At least there is a workaround, thanks!

mikehale commented 7 years ago

/cc @heroku/core-services