Build trigger API fails on certain commit message

Here is the curl snippet:

curl<stripped>/build/start.json --data '{"hook_info":{"type":"bitrise","api_token":"<stripped>"},"build_params":{"branch":"master","commit_message":"- CommitMessage: Update dependency eslint-plugin-react to v7.7.0\nThis Pull Request updates dependency [eslint-plugin-react]( from `v7.6.1` to `v7.7.0`\n<details>\n<summary>Release Notes</summary>\n### [`v7.7.0`](\n##### Added\n* [`forbid-foreign-prop-types`][]: add `allowInPropTypes` option ([#1655][] @iansu)\n* Add [`jsx-max-depth`][] rule ([#1260][] @chriswong)\n##### Fixed\n* [`no-access-state-in-setstate`][]: Exclude references to this.state in setState callback ([#1610][] @pfhayes)\n* [`no-danger-with-children`][]: prevent infinite loop ([#1571][] @ljharb)\n* [`sort-prop-types`][]: Fix sortShapeProp when shape is not an object literal ([#1669][] @justinanastos)\n* [`jsx-child-element-spacing`][]: fix error location ([#1666][] @pfhayes)\n* [`no-unused-prop-types`][]: fix for createClass ([#1675][] @yuri-sakharov)\n* [`prop-types`][]: include nextProps checking in shouldComponentUpdate ([#1690][] @amerryma)\n* [`jsx-curly-spacing`][]: refactor to fix start and end-braces in a single pass ([#1414][] @s-h-a-d-o-w)\n##### Changed\n* [`jsx-child-element-spacing`][]: add missing docs ([#1665][] @pfhayes); fix docs ([#1670][] @SammyM)\n[7.7.0]:\n[#1690]:\n[#1675]:\n[#1670]:\n[#1669]:\n[#1666]:\n[#1655]:\n[#1610]:\n[#1414]:\n[#1260]:\n[#1571]:\n---\n</details>\n<details>\n<summary>Commits</summary>\n#### v7.7.0\n-   [`cfd3959`]( [Docs] add `jsx-child-element-spacing`\n-   [`70e8a02`]( Merge pull request [#1610]( from pfhayes/setstate\n-   [`5e1a64c`]( [Fix] `no-danger-with-children`: prevent infinite loop\n-   [`d8dff26`]( test(sort-prop-types) Add failing test for when `sortShapeProp` is true and shape not object literal\n-   [`17ac433`]( fix(sort-prop-types): Fix sortShapeProp when shape is not an object literal\n-   [`d818f2b`]( Merge pull request [#1669]( from justinanastos/fix/sort-prop-types-shape-no-properties-1668\n-   [`05c49d4`]( [Fix] `jsx-child-element-spacing`: fix error location\n-   [`2839b5d`]( Fix an issue with the documentation for 'jsx-child-element-spacing'\n-   [`d318e52`]( Remove failing test for renamed React import\n-   [`dda03e9`]( Created test\n-   [`78e2951`]( Fixed bug\n-   [`b1444be`]( Added more tests\n-   [`24658b5`]( Added more valid tests\n-   [`3d83d13`]( Added more tests\n-   [`fb2fefd`]( Merge pull request [#1675]( from yuri-sakharov/fix/react-no-unused-prop-types\n-   [`90e3767`]( Update no-unused-prop-types rule for new React class component lifecycles\n-   [`c0c7ce0`]( Update no-unused-prop-types rule to be aware of 16.3 lifecycle changes\n-   [`352642f`]( Add common use-case tests and fix bugs\n-   [`830fc3d`]( Fix lint errors\n-   [`0f480f6`]( Add commented-out createClass tests\n-   [`0e2e046`]( [Dev Deps] update `babel-eslint`, `eslint`, `istanbul`, `mocha`\n-   [`abe8381`]( Update CHANGELOG and bump version\n</details>\n---\nThis PR has been generated by [Renovate Bot](\n - WorkflowID: android\n - BranchDest: master","workflow_id":"t"},"triggered_by":"curl"}'


* We are completely uploaded and fine
< HTTP/1.1 500 Internal Server Error
< Server: Cowboy
< Date: Wed, 04 Apr 2018 00:36:42 GMT
< Connection: keep-alive
< Content-Length: 77
< Via: 1.1 vegur
An unhandled lowlevel error occurred. The application logs may have details.

And original issue:

1 Like

Hi @koral,

The issue is that the commit message includes ' ('jsx-child-element-spacing') in your above curl call.

If you want to use the trigger api with more complex inputs I’d suggest you to not to use Bash/curl for that, but instead use Go or Ruby or another script language which supports proper JSON serialization.

The above curl call will not work because --data '{.. <- you used a single quote as the starting char of the data string, but the commit message includes ' too, so that will end the string and the rest will be interpreted by Bash as a param for curl, not as the content of the --data.

If you’d have any questions just let us know! :wink:

It does not work either from Go. See the linked issue and Go source code.

Can you provide a sample data set we could use to reproduce this issue?

I tried with the Commit Message from and it worked perfectly for me (not with curl, but from the Web UI, which uses the same endpoint).

Here is the JSON serialization:
Just tried with same commit message:

Any suggestion how to fix that?

Anyway, even if client sends malformed request shouldn’t API respond with error 400 instead of 500?

The error invalid character 'A' looking for beginning of value is coming from the de-serializer code at: - it’s not the error our server returns. Most likely the server returns a non JSON response here, and so the json.Unmarshal line returns a JSON unmarshal error as the content is not a valid JSON body.

Strange indeed, will try to check why a 500 is returned :thinking:

Happy to see that it’s not just me who has a “Sandbox” / “testing” app registered on solely for testing configs quickly :wink:

That non-JSON response is already attached in the 1st post: An unhandled lowlevel error occurred. The application logs may have details..

Step indeed fails to parse responses which are not JSONs but still a real issue is that such response is returned by API.

It looks like a bug on server side or maybe in Go JSON marshaller so API receives an invalid request. I don’t see anything which I can fix on the step side.

1 Like

Indeed, sorry I missed that.

After a bit of debugging this seems to be related to the length of the commit message. Not sure yet why, and why the server returns 500, but testing with the commit message and deleting parts of it it eventually works, regardless of from where you delete lines from the reported commit/build msg param, so it’s most likely related to its length.

It seems it’s not just the length… Anyway, we’ll definitely debug this more, thanks for reporting! We’ll update you here once we can figure out what the issue is and a fix is deployed! :slight_smile:

Hey there @koral,

Seems to me that your request is missing a header, I’ve added the Content-Type header with the value applicaiton/json and it seemed to work for me. Somehow the body of the request is either cropped or some encoding issue.

Let me know if this solves the issue for you too :wink:

1 Like

Yep, it fixes the issue.
So it seems that documentation on devcenter should be updated. Here: there is nothing about Content-Type, curl snippets don’t specify it.

I’ve just created a PR with new step version on steplib.


Definitely, that header should be mentioned in the Devcenter description, so I’ll complete the documentation. Thank you for the notice :slight_smile: