storyData is blank in outgoing requests to the configured feed.http-hooks


#1

Observed Behavior:
When a POST request is created by Phabricator based on the feed.http-hooks configuration, the value of the storyData param is left blank.

Expected Behavior:
The value of storyData should be populated. I believe it used to include at least objectPHID.

Phabricator Version:
phabricator: 113a2773dd5bb41921dedc2205820d528ca42db6 (Wed, Feb 6)
arcanist: 25c2381959ac94d9249ae4023c5f9ea36436b81c (Dec 28 2018)
phutil: 4c0189895bee2ec3dd088bf64ce19e1158ab072f (Tue, Feb 5)
php: 7.2.10-0ubuntu0.18.04.1

Reproduction Steps:

  • Configure a fresh Phabricator instance (I used Docker, see the Dockerfile below if you choose to do this, I tried on another instance too to double check).
  • Configure phabricator.base-uri to your base URI.
  • Configure feed.http-hooks, for example, set it to '["http://localhost:8123"]'
  • Run a local netcat instance to see what Phabricator will send (e.g. nc -k -l -p 8123).
  • Do anything on Phabricator that generates a feed story, for example, create a new task.
  • Notice the request that netcat reports has a blank storyData, for example:
POST / HTTP/1.1
Host: localhost:8123
Accept: */*
Content-Length: 196
Content-Type: application/x-www-form-urlencoded

storyID=1&storyType=PhabricatorApplicationTransactionFeedStory&storyData=&storyAuthorPHID=PHID-USER-dmi22btz6awe4yscaxyw&storyText=admin%20added%20a%20comment%20to%20T1%3A%20Test.&epoch=1549497301

#2

If anyone is interested in creating the fresh instance with Docker, the Dockerfile is:

FROM ubuntu:18.04
MAINTAINER Sinan Taifour "sinan@taifour.com"

RUN apt-get update && apt-get install -y git && \
    apt-get autoremove -y && apt-get autoclean -y && \
    rm -rf /var/lib/apt/lists/*

RUN cd /root && \
    git clone https://github.com/phacility/libphutil.git && \
    git clone https://github.com/phacility/phabricator.git && \
    git clone https://github.com/phacility/arcanist.git

RUN apt-get update && \
    apt-get install -y tree htop vim curl && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && \
    ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
    dpkg-reconfigure --frontend noninteractive tzdata && \
    apt-get install -y mysql-server apache2 libapache2-mod-php php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring && \
    apt-get autoremove -y && apt-get autoclean -y && \
    rm -rf /var/lib/apt/lists/*

RUN service mysql start && \
    echo "CREATE USER 'phabricator'@'localhost' IDENTIFIED BY 'phabricator';" | mysql && \
    echo "GRANT ALL PRIVILEGES ON *.* TO 'phabricator'@'localhost';" | mysql && \
    cd /root/phabricator && \
    ./bin/config set mysql.user "phabricator" && \
    ./bin/config set mysql.pass "phabricator" && \
    ./bin/storage upgrade --force

COPY phabricator.conf /etc/apache2/sites-available/

RUN rm /etc/apache2/sites-*/000-default.conf && \
    a2enmod rewrite && \
    a2ensite phabricator && \
    chmod 750 /root && \
    chown -R root:www-data /root

RUN echo "ls" >> /root/.bashrc

ENTRYPOINT service mysql start >/dev/null && \
    service apache2 start >/dev/null 2>/dev/null && \
    /root/phabricator/bin/phd start && \
    cd /root && /bin/bash

EXPOSE 80

And phabricator.conf contains:

<VirtualHost *>
  ServerName ph.local
  DocumentRoot /root/phabricator/webroot
  <Directory "root/phabricator/webroot">
    Require all granted
  </Directory>
  RewriteEngine on
  RewriteRule ^(.*)$ /index.php?__path__=$1  [B,L,QSA]
</VirtualHost>

#3

I think this was an unintended consequence of D20049, which replaced http_build_query() with phutil_build_http_querystring(). However, http_build_query() accepts nested parameters, while phutil_build_http_querystring() does not.

I’ll revert this behavior, but feed.http-hooks has been deprecated for about a year, since 2018 Week 6 (see: https://secure.phabricator.com/w/changelog/2018.06/). You are strongly encouraged to move from feed.http-hooks to Webhooks, as support for feed.http-hooks will eventually be removed.


#4

Thanks, I actually discovered that feed.http-hooks is deprecated while trying to debug this issue. I should read the changelog more closely. We’ll make sure to move off it.

Thanks a lot!


#5

#6

Is there any plan to have anything similar to “storyText” for webhooks, then? It’s kind of a pain to make a human-readable summary of an event as it stands today…