Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Fetcher throws incorrect error with zero-config_vars attachments #139

Open
keiko713 opened this issue Jun 29, 2017 · 3 comments
Open

Fetcher throws incorrect error with zero-config_vars attachments #139

keiko713 opened this issue Jun 29, 2017 · 3 comments

Comments

@keiko713
Copy link
Contributor

During the provisioning, there is a timing that there's an attachment but there's not config_vars.
Under that condition, https://github.com/heroku/heroku-pg/blob/master/lib/fetcher.js#L61 will throw the error https://github.com/heroku/heroku-pg/blob/master/lib/util.js#L12 .

This is especially bad for staging environment where we actually need to reach to that point (for prod, usually resolving addon finishes before hitting there).

@msakrejda
Copy link
Contributor

@keiko713 Can you give me a full command and the error that you get, with HEROKU_DEBUG=1?

@keiko713
Copy link
Contributor Author

Sooo this works well:

$ heroku addons:info postgresql-keiko-round-62133 -a kwal
=== postgresql-keiko-round-62133
Attachments:  kwal::HEROKU_POSTGRESQL_KEIKO_COBALT
Installed at: Wed Jul 19 2017 15:46:46 GMT-0700 (PDT)
Owning app:   kwal
Plan:         heroku-postgresql-keiko:standard-0
Price:        free
State:        creating

but this doesn't:

$ HEROKU_DEBUG=1 heroku pg:info HEROKU_POSTGRESQL_KEIKO_COBALT_URL -a kwal
--> GET /apps/kwal/config-vars
--> POST /actions/addon-attachments/resolve
--> {"app":"kwal","addon_attachment":"HEROKU_POSTGRESQL_KEIKO_COBALT_URL","addon_service":"heroku-postgresql"}
<-- 200 OK
<-- {"HEROKU_POSTGRESQL_KEIKO_CRIMSON_URL":"postgres://(redacted)@ec2-52-7-69-235.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_GOLD_URL":"postgres://(redacted)@ec2-54-172-12-2.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_IVORY_URL":"postgres://(redacted)@ec2-52-200-190-25.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_URL":"postgres://(redacted)@ec2-34-227-245-157.compute-1.amazonaws.com:5432/des2t3su7sal1i"}
<-- 404 Not Found
<-- {"resource":"add_on attachment","id":"not_found","message":"Couldn't find that add on attachment."}
--> GET /apps/kwal/config-vars
--> GET /apps/kwal/addon-attachments
<-- 200 OK
<-- {"HEROKU_POSTGRESQL_KEIKO_CRIMSON_URL":"postgres://(redacted)@ec2-52-7-69-235.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_GOLD_URL":"postgres://(redacted)@ec2-54-172-12-2.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_IVORY_URL":"postgres://(redacted)@ec2-52-200-190-25.compute-1.amazonaws.com:5432/des2t3su7sal1i","HEROKU_POSTGRESQL_KEIKO_URL":"postgres://(redacted)@ec2-34-227-245-157.compute-1.amazonaws.com:5432/des2t3su7sal1i"}
<-- 200 OK
<-- [{"addon":{"id":"c3ed2d46-acdb-4d05-89f8-cb0fb9514097","name":"postgresql-keiko-round-62133","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"0fa646d8-f76f-45b2-be2f-803e75cc4378","name":"HEROKU_POSTGRESQL_KEIKO_COBALT","namespace":null,"created_at":"2017-07-19T22:46:47Z","updated_at":"2017-07-19T22:46:47Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/c3ed2d46-acdb-4d05-89f8-cb0fb9514097","config_vars":[]},{"addon":{"id":"64fafad1-8aff-40e6-9971-9894511568d9","name":"postgresql-keiko-closed-25136","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"3a3f4e8f-c629-40bb-a98e-175ea4e666d4","name":"HEROKU_POSTGRESQL_KEIKO_CRIMSON","namespace":null,"created_at":"2017-07-13T23:21:47Z","updated_at":"2017-07-13T23:21:47Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/64fafad1-8aff-40e6-9971-9894511568d9","config_vars":["HEROKU_POSTGRESQL_KEIKO_CRIMSON_URL"]},{"addon":{"id":"95ae8eb2-5cdc-44b0-8536-f932594ab081","name":"postgresql-keiko-clear-49392","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"3d6c83a7-4b95-4e27-97a3-b82bf204484e","name":"HEROKU_POSTGRESQL_KEIKO_IVORY","namespace":null,"created_at":"2017-07-19T18:41:08Z","updated_at":"2017-07-19T18:41:08Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/95ae8eb2-5cdc-44b0-8536-f932594ab081","config_vars":["HEROKU_POSTGRESQL_KEIKO_IVORY_URL"]},{"addon":{"id":"f78d2e90-e221-4aa2-bea2-8ae2ef38d03d","name":"postgresql-keiko-fitted-23813","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"8187a91a-45fd-4458-a8a0-0e3e3b33a589","name":"HEROKU_POSTGRESQL_KEIKO_TEAL","namespace":null,"created_at":"2017-07-18T22:53:38Z","updated_at":"2017-07-18T22:53:38Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/f78d2e90-e221-4aa2-bea2-8ae2ef38d03d","config_vars":[]},{"addon":{"id":"3c74b0ef-d6a3-4c2c-acfe-51bab3dd7c2d","name":"postgresql-keiko-rugged-37057","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"a8fbd440-f29b-44fe-beba-e756c2b50c20","name":"HEROKU_POSTGRESQL_KEIKO_GOLD","namespace":null,"created_at":"2017-07-19T18:06:34Z","updated_at":"2017-07-19T18:06:34Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/3c74b0ef-d6a3-4c2c-acfe-51bab3dd7c2d","config_vars":["HEROKU_POSTGRESQL_KEIKO_GOLD_URL"]},{"addon":{"id":"2f894865-393d-4cc5-803c-abe1a3727611","name":"postgresql-keiko-clean-60847","app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"plan":{"id":"07dbebf8-45ad-45f1-b152-e6fc86bc7e57","name":"heroku-postgresql-keiko:standard-0"}},"app":{"id":"c5be4c37-6801-4f08-9249-860aaae13ff6","name":"kwal"},"id":"d1100b9e-521b-4390-a9e3-327c3c639b9a","name":"HEROKU_POSTGRESQL_KEIKO","namespace":null,"created_at":"2017-07-03T18:02:55Z","updated_at":"2017-07-03T18:02:55Z","web_url":"https://addons-sso.heroku.com/apps/c5be4c37-6801-4f08-9249-860aaae13ff6/addons/2f894865-393d-4cc5-803c-abe1a3727611","config_vars":["HEROKU_POSTGRESQL_KEIKO_URL"]}]
 ▸    Database URL not found for this addon
Error: Database URL not found for this addon
    at Object.getUrl (/Users/koda/.local/share/heroku/client/node_modules/heroku-pg/lib/util.js:12:42)
    at attachments.map.attachment (/Users/koda/.local/share/heroku/client/node_modules/heroku-pg/lib/fetcher.js:64:65)
    at Array.map (native)
    at attachment (/Users/koda/.local/share/heroku/client/node_modules/heroku-pg/lib/fetcher.js:64:40)
    at attachment.next (<anonymous>)
    at onFulfilled (/Users/koda/.local/share/heroku/client/node_modules/co/index.js:65:19)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

@keiko713
Copy link
Contributor Author

it's kinda "you shouldn't really hit" thing in prod so pretty low priority maybe. if you want to repro by yourself, let me know.

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

No branches or pull requests

2 participants