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

Issue with domain#create #86

Open
slant opened this issue May 8, 2018 · 1 comment
Open

Issue with domain#create #86

slant opened this issue May 8, 2018 · 1 comment

Comments

@slant
Copy link

slant commented May 8, 2018

I'm hoping I'm just doing something wrong here. When calling heroku.domain.create(), I'm getting a 400 error.

To start, here's what works.

irb(main):003:0> heroku.domain.list('[email protected]')
=> [{"acm_status"=>nil, ...}]

irb(main):004:0> heroku.domain.delete('[email protected]', '*.example.com')
=> {"acm_status"=>nil, ...}
# I was able to confirm that this does delete the domain

And here's what doesn't.

irb(main):005:0> heroku.domain.create('UUID_HERE', '*.example.com')
Excon::Error::NotFound: Expected([200, 201, 202, 204, 206, 304]) <=> Actual(404 Not Found)

irb(main):006:0> heroku.domain.create('my-app-name', '*.example.com')
Excon::Error::BadRequest: Expected([200, 201, 202, 204, 206, 304]) <=> Actual(400 Bad Request)

irb(main):007:0> heroku.domain.create('[email protected]', '*.example.com')
Excon::Error::BadRequest: Expected([200, 201, 202, 204, 206, 304]) <=> Actual(400 Bad Request)

Our API docs suggest that either the UUID or app name should suffice (even the heroku_id works in the delete example above!), which makes me wonder why using the UUID returns a 404 while the app name example returns a 400.

Am I just doing something dumb? It seems pretty straightforward.

Update: in a humbling turn of events, the alternate error I was receiving above for the UUID method was indeed valid; I somehow had the wrong UUID for the app. correcting this yields the same 400 BadRequest error the other two commands were returning.

Using EXCON_DEBUG returns the following (assuming the important bits, omitting others - let me know if you need something else):

  :body                => "\"*.example.com\""
  :host                => "api.heroku.com"
  :hostname            => "api.heroku.com"
  :method              => :post
  :path                => "/apps/UUID_HERE/domains"
@mikehale
Copy link
Contributor

mikehale commented May 8, 2018

The second parameter requires an object. Try something like: heroku.domain.create(app, {hostname: '*.example.com'}).

You can also check the error messages for clues by setting EXCON_DEBUG=1 in the environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants