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

table.insert not firing #1277

Closed
dblooman opened this issue Oct 11, 2016 · 8 comments
Closed

table.insert not firing #1277

dblooman opened this issue Oct 11, 2016 · 8 comments
Assignees

Comments

@dblooman
Copy link

Further to the issue I raised yesterday, the latest version seems to have broken my hook, it never gets invoked.

Here is the hook code

'hooks' => [
       'table.insert' => function ($tableName, $record) {
          $credentials = array('key'    => 'key',
                               'secret' => 'secret');

          $client = new SnsClient(array(
              'credentials' => $credentials,
              'region'  => 'eu-west-1',
              'version' => "2010-03-31"
          ));


          $keys = array_keys($record);
          $arr = array(
            "postID" => (int)$record[$keys[0]],
            "tableName" => $tableName,
            "status" => (int)$record[$keys[1]]
          );

           $result = $client->publish(array(
              'TopicArn' => 'arn:aws:sns:eu-west-1:0000000000:cms-events',
              'Message' => $record,
              'Subject' => 'CMS Event'
          ));
        }

    ]

Version Info

  • Directus version and branch: 6.3.4
  • PHP version: 5.5
  • Web server: Apache
  • OS name and version: Ubuntu

Expected Behavior

Hook sends message

Actual Behavior

Hook doesn't send message

Steps to Reproduce

  1. Create new post
  2. Hook doesn't trigger

Logs or Screenshots

No error logs

@wellingguzman wellingguzman self-assigned this Oct 11, 2016
@wellingguzman wellingguzman added this to the 6.3.x (Lapis Lepus) milestone Oct 11, 2016
@wellingguzman
Copy link

Thanks for reporting this @DaveBlooman , I'm working on it.

@wellingguzman
Copy link

Hello @DaveBlooman, I push a fixes for the issue here: 9039d68, hope it works for you too.

It's only on development, but it will be soon release.

@dblooman
Copy link
Author

I haven't tested this, but I assume table.update works too, will report back once i have tried

@dblooman
Copy link
Author

Fix works great. Look forward to the next release

@wellingguzman
Copy link

Amazing @DaveBlooman, great to hear. As always, anything else, let us know.

Closing it.

@dblooman
Copy link
Author

dblooman commented Nov 8, 2016

So, just noticed that table.update is very different in the data it gives.

{
    "output": {
        "last_page": "{\"path\":\"tables/new_features/24\",\"route\":\"entry\"}",
        "last_access": "2016-11-08 12:15:00",
        "id": 1
    }
}

This previously included post ID, status, last access, but now doesn't include post ID. I'm pretty sure that id is actually meant to be status as well.

@wellingguzman
Copy link

Hey @DaveBlooman, that's the data the table.update is sending?

I'm going to take a look at this and get back to you, asap.

@wellingguzman
Copy link

What's inside the output it seems to be the directus_users update data.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
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