Hello team, I am facing an issue. When I self-host...
# help
s
Hello team, I am facing an issue. When I self-hosted the cloud pricing API on k8s using your helm chart, I was successfully able to get the valid API response on doing
infracost breakdown --path ./plan.json
when I self-hosted it using docker, I got an Invalid API response for the same plan.json. It fails on Retrieving cloud prices to calculate the cost step. I do receive a valid response to this request.
Copy code
curl <https://0.0.0.0:4000/graphql> \
  -X POST \
  -H 'X-Api-Key: mpUoVUzva1jo03DHOePJswFEex3DeY0t' \
  -H 'Content-Type: application/json' \
  --data '
  {"query": "{ products(filter: {vendorName: \"aws\", service: \"AmazonEC2\", region: \"us-east-1\", attributeFilters: [{key: \"instanceType\", value: \"m3.large\"}, {key: \"operatingSystem\", value: \"Linux\"}, {key: \"tenancy\", value: \"Shared\"}, {key: \"capacitystatus\", value: \"Used\"}, {key: \"preInstalledSw\", value: \"NA\"}]}) { prices(filter: {purchaseOption: \"on_demand\"}) { USD } } } "}
  '
l
Hi @straight-cat-63864. What is the error you see?
s
18jul.png
l
Can you run with
--log-level=debug
please?
s
I did
l
Can you paste the output please?
s
Copy code
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled|github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled>" file="<http://github.com/infracost/infracost/internal/config/run_context.go:229|github.com/infracost/infracost/internal/config/run_context.go:229>" is_cloud_enabled=false enable_cloud_org=false currency=USD msg="IsCloudEnabled inferred from Config.EnabledDashboard"
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled|github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled>" file="<http://github.com/infracost/infracost/internal/config/run_context.go:229|github.com/infracost/infracost/internal/config/run_context.go:229>" is_cloud_enabled=false enable_cloud_org=false currency=USD msg="IsCloudEnabled inferred from Config.EnabledDashboard"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func="<http://github.com/infracost/infracost/internal/vcs.(*metadataFetcher).Get|github.com/infracost/infracost/internal/vcs.(*metadataFetcher).Get>" file="<http://github.com/infracost/infracost/internal/vcs/metadata.go:343|github.com/infracost/infracost/internal/vcs/metadata.go:343>" currency=USD sync_usage=false msg="could not detect a specific CI system, fetching local Git metadata"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func=main.runMain file="<http://github.com/infracost/infracost/cmd/infracost/run.go:90|github.com/infracost/infracost/cmd/infracost/run.go:90>" currency=USD sync_usage=false error="could not open git directory to fetch metadata repository does not exist" msg="failed to fetch vcs metadata for path ./plan.json"
time="2023-07-18T14:38:11+05:30" level=info file="<http://github.com/infracost/infracost/cmd/infracost/run.go:362|github.com/infracost/infracost/cmd/infracost/run.go:362>" func="main.(*parallelRunner).runProjectConfig" msg="Detected Terraform plan JSON file at ./plan.json"
time="2023-07-18T14:38:11+05:30" level=info file="<http://github.com/infracost/infracost/internal/ui/spin.go:41|github.com/infracost/infracost/internal/ui/spin.go:41>" func=<http://github.com/infracost/infracost/internal/ui.NewSpinner|github.com/infracost/infracost/internal/ui.NewSpinner> msg="Starting: Extracting only cost-related params from terraform"
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func=<http://github.com/infracost/infracost/internal/config.gitSubPath|github.com/infracost/infracost/internal/config.gitSubPath> file="<http://github.com/infracost/infracost/internal/config/project_context.go:95|github.com/infracost/infracost/internal/config/project_context.go:95>" error="failed to detect a git directory in path ./plan.json of any of its parent dirs repository does not exist" enable_cloud_org=false currency=USD msg="Could not get git top level directory for ./plan.json"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func="<http://github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled|github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled>" file="<http://github.com/infracost/infracost/internal/config/run_context.go:229|github.com/infracost/infracost/internal/config/run_context.go:229>" currency=USD sync_usage=false is_cloud_enabled=false msg="IsCloudEnabled inferred from Config.EnabledDashboard"
time="2023-07-18T14:38:11+05:30" level=info file="<http://github.com/infracost/infracost/internal/ui/spin.go:41|github.com/infracost/infracost/internal/ui/spin.go:41>" func=<http://github.com/infracost/infracost/internal/ui.NewSpinner|github.com/infracost/infracost/internal/ui.NewSpinner> msg="Starting: Retrieving cloud prices to calculate costs"
time="2023-07-18T14:38:11+05:30" level=debug file="<http://github.com/infracost/infracost/internal/apiclient/pricing.go:123|github.com/infracost/infracost/internal/apiclient/pricing.go:123>" func="<http://github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries|github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries>" msg="Getting pricing details from <http://0.0.0.0:4000/> for aws_waf_web_acl.internal_office"
time="2023-07-18T14:38:11+05:30" level=debug file="<http://github.com/infracost/infracost/internal/apiclient/pricing.go:123|github.com/infracost/infracost/internal/apiclient/pricing.go:123>" func="<http://github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries|github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries>" msg="Getting pricing details from <http://0.0.0.0:4000/> for aws_rds_cluster_instance.db_0_test_test_rds_rds_cluster_aurora"
time="2023-07-18T14:38:11+05:30" level=debug file="<http://github.com/infracost/infracost/internal/apiclient/pricing.go:123|github.com/infracost/infracost/internal/apiclient/pricing.go:123>" func="<http://github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries|github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries>" msg="Getting pricing details from <http://0.0.0.0:4000/> for aws_waf_web_acl.internal_office"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" currency=USD sync_usage=false msg="'POST' request to '/graphql' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:11+05:30" level=debug file="<http://github.com/infracost/infracost/internal/apiclient/pricing.go:123|github.com/infracost/infracost/internal/apiclient/pricing.go:123>" func="<http://github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries|github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries>" msg="Getting pricing details from <http://0.0.0.0:4000/> for aws_rds_cluster.cluster_test_test_rds_rds_cluster_aurora"
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" enable_cloud_org=false currency=USD msg="'POST' request to '/graphql' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" currency=USD sync_usage=false msg="'POST' request to '/graphql' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:11+05:30" level=debug file="<http://github.com/infracost/infracost/internal/apiclient/pricing.go:123|github.com/infracost/infracost/internal/apiclient/pricing.go:123>" func="<http://github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries|github.com/infracost/infracost/internal/apiclient.(*PricingAPIClient).RunQueries>" msg="Getting pricing details from <http://0.0.0.0:4000/> for aws_rds_cluster_instance.db_1_test_test_rds_rds_cluster_aurora"
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" enable_cloud_org=false currency=USD msg="'POST' request to '/graphql' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:11+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" enable_cloud_org=false currency=USD msg="'POST' request to '/graphql' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:11+05:30" level=debug library=retryablehttp func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" enable_cloud_org=false currency=USD sync_usage=false msg="performing request method POST url <http://0.0.0.0:4000//graphql>"
time="2023-07-18T14:38:11+05:30" level=debug enable_cloud_org=false func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" currency=USD sync_usage=false library=retryablehttp msg="performing request method POST url <http://0.0.0.0:4000//graphql>"
time="2023-07-18T14:38:11+05:30" level=debug currency=USD func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" sync_usage=false library=retryablehttp enable_cloud_org=false msg="performing request method POST url <http://0.0.0.0:4000//graphql>"
time="2023-07-18T14:38:11+05:30" level=debug library=retryablehttp func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" enable_cloud_org=false currency=USD sync_usage=false msg="performing request method POST url <http://0.0.0.0:4000//graphql>"
time="2023-07-18T14:38:11+05:30" level=debug library=retryablehttp func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" enable_cloud_org=false currency=USD sync_usage=false msg="performing request method POST url <http://0.0.0.0:4000//graphql>"

time="2023-07-18T14:38:12+05:30" level=debug currency=USD func=<http://github.com/infracost/infracost/internal/config.gitSubPath|github.com/infracost/infracost/internal/config.gitSubPath> file="<http://github.com/infracost/infracost/internal/config/project_context.go:95|github.com/infracost/infracost/internal/config/project_context.go:95>" sync_usage=false error="failed to detect a git directory in path ./plan.json of any of its parent dirs repository does not exist" enable_cloud_org=false msg="Could not get git top level directory for ./plan.json"
time="2023-07-18T14:38:12+05:30" level=debug is_cloud_enabled=false func="<http://github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled|github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled>" file="<http://github.com/infracost/infracost/internal/config/run_context.go:229|github.com/infracost/infracost/internal/config/run_context.go:229>" currency=USD sync_usage=false enable_cloud_org=false msg="IsCloudEnabled inferred from Config.EnabledDashboard"
time="2023-07-18T14:38:12+05:30" level=debug is_cloud_enabled=false func="<http://github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled|github.com/infracost/infracost/internal/config.(*RunContext).IsCloudEnabled>" file="<http://github.com/infracost/infracost/internal/config/run_context.go:229|github.com/infracost/infracost/internal/config/run_context.go:229>" enable_cloud_org=false currency=USD sync_usage=false msg="IsCloudEnabled inferred from Config.EnabledDashboard"
time="2023-07-18T14:38:12+05:30" level=debug file="<http://github.com/infracost/infracost/cmd/infracost/run.go:139|github.com/infracost/infracost/cmd/infracost/run.go:139>" func=main.runMain msg="Skipping sending project results since Infracost Cloud upload is not enabled."
time="2023-07-18T14:38:12+05:30" level=debug sync_usage=false func="<http://github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest|github.com/infracost/infracost/internal/apiclient.(*APIClient).doRequest>" file="<http://github.com/infracost/infracost/internal/apiclient/client.go:57|github.com/infracost/infracost/internal/apiclient/client.go:57>" enable_cloud_org=false currency=USD msg="'POST' request to '/event' using trace_id: '259de1ac-42bb-4845-adac-8dbdadc7a06b'"
time="2023-07-18T14:38:12+05:30" level=debug library=retryablehttp func="<http://github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug|github.com/infracost/infracost/internal/apiclient.(*LeveledLogger).Debug>" file="<http://github.com/infracost/infracost/internal/apiclient/log.go:25|github.com/infracost/infracost/internal/apiclient/log.go:25>" enable_cloud_org=false currency=USD sync_usage=false msg="performing request method POST url <http://0.0.0.0:4000//event>"
time="2023-07-18T14:38:12+05:30" level=error file="<http://github.com/infracost/infracost/cmd/infracost/run.go:169|github.com/infracost/infracost/cmd/infracost/run.go:169>" func=main.runMain msg="Error reporting event: Invalid API response: 404 Not Found"
l
Looks like there’s an extra trailing
/
in your
INFRACOST_PRICING_API_ENDPOINT
config value
<https://0.0.0.0:4000//graphql>
.
Try setting that value to just
<https://0.0.0.0:4000>
without any trailing slash
s
ohh😢, thank you so much, feeling so dumb now
l
No at all, we should add something to strip that automatically or show a better error.