# Cannot load such file -- chef-handler-httpapi

**URL:** <https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535>\
**Category:** Chef Infra (archive)\
**Created:** [February 6, 2018, 10:40am UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535 "2018-02-06T10:40:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![coul](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@coul](https://discourse.chef.io/u/coul)\
**Post date:** [February 6, 2018, 10:40am UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535/1 "2018-02-06T10:40:02Z")

</div>

I want to add [httpapi handler](https://github.com/b1-systems/chef-handler-httpapi)  
Here is my cookbook

```
chef_gem 'chef-handler-httpapi'

template "/etc/chef/client.d/httpapi_handler.rb" do
  source "httpapi_handler.rb.erb"
  mode '0644'
  notifies :create, "ruby_block[reload_client_config]"
end

include_recipe 'chef-client::config'

```

**/etc/chef/client.d/httpapi\_handler.rb**

```auto
require "chef-handler-httpapi"

api_url = "http://example.com/api/alerts"
api_user = admin
api_pass = pass

# ssl tweaks
(api_ssl_version = :SSLv3)
(api_ssl_verify = "none")

# name for data_message KEY
api_data_message = "message"

# keys and values for successful run
api_data_success = {
	"state" => "INFO",
	"class" => "chef-client"
}

# keys and values for failed run
api_data_failed = {
	"state" => "FAILED",
	"class" => "chef-client"
}

Httpapi_handler = Httpapi.new(api_url, api_user, api_pass, api_ssl_verify, api_ssl_version, api_data_message, api_data_success, api_data_failed)
report_handlers << Httpapi_handler # run at the end of a successful run
exception_handlers << Httpapi_handler # run at the end of a failed run

```

When I run chef-client I get

```auto
[2018-02-06T09:47:11+00:00] FATAL: Configuration error LoadError: cannot load such file -- chef-handler-httpapi
[2018-02-06T09:47:11+00:00] FATAL: /etc/chef/client.d/httpapi_handler.rb:1:in `from_string'
[2018-02-06T09:47:11+00:00] FATAL: Aborting due to error in '/etc/chef/client.d/httpapi_handler.rb'

```

**chef\_gem is installed**

```auto
/opt/chef/embedded/bin/gem list | grep http
chef-handler-httpapi (0.0.2)

```

**Chef Client, version 12.21.31**

- chef-client (9.0.5)
- chef\_handler (3.0.2)

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [February 7, 2018, 6:06pm UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535/2 "2018-02-07T18:06:47Z")

</div>

> [@coul](#):
>
> require "chef-handler-httpapi"

The `require` method in ruby refers to the paths to the ruby files, which for plugin-y gems can be a bit different than the gem name. I looked at the repo in question, and while their README says `require "chef-handler-httpapi"`, based on the paths in the repo it looks like it would instead be `require "chef/handler/Httpapi"`

You might want to file an issue for that one.

---

<div class="post-metadata">

**Author:** ![coul](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@coul](https://discourse.chef.io/u/coul)\
**Post date:** [February 8, 2018, 1:06pm UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535/3 "2018-02-08T13:06:56Z")

</div>

Thanks, it was the point. I’ll post the issue.

---

<div class="post-metadata">

**Author:** ![waldt](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/waldt/32/1887_2.png) [@waldt](https://discourse.chef.io/u/waldt)\
**Post date:** [February 8, 2018, 1:54pm UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535/4 "2018-02-08T13:54:06Z")

</div>

Just saw, that we use `require 'Httpapi.rb'` in our setup, which works out.  
Are you fine with me updating the README like this?

---

<div class="post-metadata">

**Author:** ![waldt](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/waldt/32/1887_2.png) [@waldt](https://discourse.chef.io/u/waldt)\
**Post date:** [February 8, 2018, 5:55pm UTC](https://discourse.chef.io/t/cannot-load-such-file-chef-handler-httpapi/12535/5 "2018-02-08T17:55:48Z")

</div>

I fixed this in [https://github.com/b1-systems/chef-handler-httpapi/commit/d8b362315a5d19175c4f0665a63fed80c8fccc70](https://github.com/b1-systems/chef-handler-httpapi/commit/d8b362315a5d19175c4f0665a63fed80c8fccc70)
