kusanagi / katana-sdk-php7 Goto Github PK
View Code? Open in Web Editor NEWPHP7 SDK for the KATANA Framework
Home Page: https://kusanagi.io
License: MIT License
PHP7 SDK for the KATANA Framework
Home Page: https://kusanagi.io
License: MIT License
The Request::newResponse()
method currently expects arguments, but the 2 arguments should be optional, falling back to 200
and "OK"
respectively.
The following error is returned:
Callback error: Language error (shutdown) (1) Uncaught TypeError: Argument 1 passed to Katana\\Sdk\\Api\\RequestApi::newResponse() must be of the type integer, none given, called in /middleware.php on line 27 and defined in /vendor/kusanagi/katana-sdk-php7/src/Api/RequestApi.php
This was using version 1.1.4 of the framework, with system info below:
Linux work 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
When a path does not exist in the URL, the HttpRequest::getUrlPath()
method should return an empty string, but it currently returns NULL
.
This was using version 1.1.4 of the framework, with system info below:
Linux work 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
When an object gets into the msgpack encoder library, it throws an exception that is currently unhandled, leading to a fatal error.
2017-08-09T15:29:45.446Z [ERROR] [SDK] Callback error: Language error (shutdown) (1) Uncaught MessagePack\Exception\PackingFailedException: Unsupported type. in /vagrant/origami/middleware-collector/vendor/rybakit/msgpack/src/Packer.php:141
Catch and handle the exception.
I encountered this error during testing locally with $ katana service action
via CLI:
Callback error: Language error (shutdown) (1) Uncaught ZMQSocketException: Failed to get the option ZMQ::SOCKOPT_EVENTS value: Interrupted system call in /vendor/react/zmq/src/React/ZMQ/SocketWrapper.php:35
Stack trace:
#0 /vendor/react/zmq/src/React/ZMQ/SocketWrapper.php(35): ZMQSocket->getsockopt(15)
#1 [internal function]: React\ZMQ\SocketWrapper->handleEvent(Resource id #44, Object(React\EventLoop\StreamSelectLoop))
#2 /vendor/react/event-loop/src/StreamSelectLoop.php(236): call_user_func(Array, Resource id #44, Object(React\EventLoop\StreamSelectLoop))
#3 /vendor/react/event-loop/src/StreamSelectLoop.php(205): React\EventLoop\StreamSelectLoop->waitForStreamActivity(98379)
#4 /vendor/kusanagi/katana-sdk-php7/src/Executor/ZeroMqLoopExecutor.php(146): React\EventLoop\StreamSelectLoop->ru...
This happened randomly during various calls, with no change to the configuration or source code.
This was using version 1.1.12 of the framework, with system info below:
Linux work 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Currently, only associative arrays are allowed as valid entities. Objects must be accepted as well. For this, public properties must be mapped as the properties of the entity.
When defining a parameter as an array using Request::newParam()
I got an error stating that the data type must be a string, yet I'm defining an array in PHP.
In my case, I'm defining an array where each item is an array, for example:
$param = $request->newParam('params', [['a', 'b', 'c'], ['d', 'e', 'f']], 'array');
Here is the error message received:
Callback error: Language error (shutdown) (1) Uncaught TypeError: Argument 2 passed to Katana\Sdk\Api\ServiceCall::newParam() must be of the type string, array given, called in /vendor/kusanagi/katana-sdk-php7/src/Api/RequestApi.php on line 270 and defined in /vendor/kusanagi/katana-sdk-php7/src/Api/ParamAccessorTrait.php:74
Stack trace:
#0 /vendor/kusanagi/katana-sdk-php7/src/Api/RequestApi.php(270): Katana\Sdk\Api\ServiceCall->newParam('params', Array, 'array')
#1 /middleware.php(45): Katana\Sdk\Api\RequestApi->newParam('params', Array, 'array')
#2 /vendor/kusanagi/katana-sdk-php7/src/Executor/AbstractExecutor.php(77): {closure}(Object(Katana\Sdk\Api\RequestApi))
#3 /vendor/kusanagi/katana-sdk-php7/src/Executor/ZeroMqLoopExecutor.php(138):
The issue appears to come from here:
https://github.com/kusanagi/katana-sdk-php7/blob/master/src/Api/ParamAccessorTrait.php#L76
This was using version 1.1.4 of the framework, with system info below:
Linux work 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Sample action received in katana 1.2.22
(removed everything not relevant):
{
"ac": {
"list": {
"t": [
"security:anonymous"
]
}
}
}
Stopping a component causes the following SDK error:
PHP Fatal error: Uncaught ZMQSocketException: Failed to unbind the ZMQ socket: No such file or directory in vendor/react/zmq/src/React/ZMQ/SocketWrapper.php:114
Explore React child processes to allow process timeout.
If feasible it will require some refactoring.
More info : http://sergeyzhuk.me/2017/08/07/reactphp-child-process/
When a value that contains content such as binary is provided as the output for a log, these are no longer visible in stdout
.
Additionally, after that log, all other logs are affected, with no further output to stdout
. This was used in a Middleware processing requests, and not even on subsequent requests were logs visible.
This was using version 1.1.5 of the framework, and version 1.1.8 of the SDK, with system info below:
Linux work 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Error appear when a file comes to the service with an http path but without a token.
[31-Oct-2017 12:44:49 UTC] PHP Fatal error: Uncaught Katana\Sdk\Exception\InvalidValueException: Missing token for File: body in .../vendor/kusanagi/katana-sdk-php7/src/Api/File.php:96
Operatoins related with packing and unpacking messages are executed outside of the context of the main try/catch
that controls user defined code.
But certain messages can produce exceptions that would crash a component. That exceptions must be captured and controlled.
Msgpack supports both maps and arrays for lists of data. When a packing is done from php, a map could be created both with string or integer keys. An msgpack array is created when the php array has only integer keys that are sequential and starting from 0.
Katana has strong types and map keys must be strings, so any integer key in a map will result in error.
Some solution is needed to prevent those errors.
The library could have some options. https://github.com/rybakit/msgpack.php#type-detection-mode
Check if the request id is being displayed in every log that needs to have it.
Currently, to activate the control bytes to send in an action response, it was checked if any calls, transactions, files or body exists in the transport. That is not entirely correct, because the check is that any of those has been added in that action.
So the solution should be a new ControlString
object to assign to the Transport
. If the action adds any of those controlled items, a flag should be set in the object. When the response is being prepared, a method ControlString->get()
should be called to generate the actual string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.