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

error: Hooks handler command not found: dredd-hooks-php #25

Closed
bkuhl opened this issue Nov 3, 2016 · 12 comments
Closed

error: Hooks handler command not found: dredd-hooks-php #25

bkuhl opened this issue Nov 3, 2016 · 12 comments

Comments

@bkuhl
Copy link

bkuhl commented Nov 3, 2016

Dredd version: 2.2.3
Dredd-hooks-php version: 1.1.5

Command: dredd /var/www/html/resources/docs/api-documentation.apib http://web/api/v1 --level=debug --language dredd-hooks-php --hookfiles /var/www/html/resources/dredd-hooks.php

The error error: Hooks handler command not found: dredd-hooks-php is always present. I've retracted my steps and am not able to figure out what I'm doing wrong. Is this version compatible with 2.2.3?

verbose: Compiling HTTP transactions from API description file: /var/www/html/resources/docs/api-documentation.apib
verbose: Starting reporters and waiting until all of them are ready.
info: Beginning Dredd testing...
verbose: Starting transaction runner.
verbose: Sorting HTTP transactions
verbose: Configuring HTTP transactions
verbose: Reading hook files and registering hooks
info: Found Hookfiles: 0=/var/www/html/resources/dredd-hooks.php
verbose: Looking up hooks handler implementation: dredd-hooks-php
verbose: Dredd instance run finished.
error: Hooks handler command not found: dredd-hooks-php
verbose: Exiting Dredd process with status '1'.
debug: Using configured custom exit() method to terminate the Dredd process.
verbose: Gracefully terminating backend server process.
verbose: No backend server process.
@ddelnano
Copy link
Owner

ddelnano commented Nov 3, 2016

@bkuhl dredd has a whitelist of --languages it supports and if it doesn't recognize it, it will attempt to run the shell command.

So either switch it to --language php or specify the whole path.

If that doesn't work reopen this issue.

@ddelnano ddelnano closed this as completed Nov 3, 2016
@bkuhl
Copy link
Author

bkuhl commented Nov 3, 2016

The usage instructions indicate to use dredd-hooks-php.

Switching to use just php the output now shows:

verbose: Reading hook files and registering hooks
info: Found Hookfiles: 0=/var/www/html/resources/dredd-hooks.php
verbose: Looking up hooks handler implementation: php
verbose: Dredd instance run finished.
error: PHP hooks handler command not found: dredd-hooks-php
Install php hooks handler by running:
$ composer require ddelnano/dredd-hooks-php --dev

However I already have the package installed:

    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "phpunit/phpunit": "~5.0",
        "vluzrmos/tinker": "^1.1",
        "barryvdh/laravel-ide-helper": "^2.2",
        "squizlabs/php_codesniffer": "^2.6",
        "ddelnano/dredd-hooks-php": "^1.1",
        "mockery/mockery": "^0.9.5",
        "doctrine/dbal": "^2.5"
    },

@ddelnano
Copy link
Owner

ddelnano commented Nov 3, 2016

Where are your composer packages installed?

@ddelnano
Copy link
Owner

ddelnano commented Nov 3, 2016

I will update the instructions to be correct but the php language flag should look in vendor/bin/dredd-php-hooks so if you have a local composer install it should just work.

@bkuhl
Copy link
Author

bkuhl commented Nov 3, 2016

I'm running dredd in it's own Docker container and the working directory in that container was not the same directory where my vendor is which appears to be the cause of the problem.

Thanks for this package, it's pretty sweet :)

@ddelnano
Copy link
Owner

ddelnano commented Nov 3, 2016

No problem, glad you find it useful.

@bkuhl
Copy link
Author

bkuhl commented Nov 4, 2016

Still having issues with it not recognizing composer is installed. I'm actually running dredd inside of a docker container where I have my application mounted. Within the dredd container I can show that vendor is accessible in the default directory:

docker-compose run --rm dredd ls -latr vendor/ddelnano                                                                                                        
total 0
drwxr-xr-x 20 root root  680 Oct 14 17:50 dredd-hooks-php
drwxr-xr-x  3 root root  102 Oct 14 17:50 .
drwxr-xr-x 42 root root 1428 Nov  4 12:50 ..

I'm running dredd relative to the root directory with the command:

docker-compose run --rm dredd dredd resources/docs/api-documentation.apib http://web/api/v1 --level=debug --language php --hookfiles resources/dredd-hooks.php

But I still see the error in the output:

error: PHP hooks handler command not found: dredd-hooks-php
Install php hooks handler by running:
$ composer require ddelnano/dredd-hooks-php --dev

It looks like dredd is providing the instructions on how to install this hooks handler as I can't find anywhere in the source for this package where those instructions are included. Am I correct?

@ddelnano
Copy link
Owner

ddelnano commented Nov 4, 2016

What is installed inside your docker container, do you have php? Also I would recommend overriding the entrypoint of your container so you can get a shell and play around with the dredd command inside the container and try and launch the hooks server yourself to see why exactly its not finding the command in your current working directory.

@ddelnano
Copy link
Owner

ddelnano commented Nov 4, 2016

Here is the error you are seeing so if you get a shell inside the dredd container and can't get which dredd-hooks-php to execute successfully the problem will still exist.

@bkuhl
Copy link
Author

bkuhl commented Dec 13, 2016

For me, I realized PHP wasn't installed on the Dredd container.

@ddelnano
Copy link
Owner

Yea in a docker environment it actually might make sense to have separate containers for the dredd hooks and dredd itself.

@ddelnano
Copy link
Owner

Like the application and the dredd hooks would live in a php container with apache / nginx / etc. And the dredd container would just need node.

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