fusio icon indicating copy to clipboard operation
fusio copied to clipboard

API call error after updating container

Open noctaia opened this issue 11 months ago • 4 comments

Hello,

After updating the container to the lastest version (pushed 4 days ago), when I call a SQLQueryRow action with an operation path like /v1/xxx?yyy=1223 I have this error:

{
    "success": false,
    "title": "PSX\\Http\\Exception\\NotFoundException",
    "message": "Entry not available in /var/www/html/fusio/vendor/fusio/adapter-sql/src/Action/SqlSelectRow.php on line 67",
    "trace": "#0 /var/www/html/fusio/vendor/fusio/engine/src/Processor.php(67): Fusio\\Adapter\\Sql\\Action\\SqlSelectRow->handle()\n#1 /var/www/html/fusio/vendor/fusio/impl/src/Service/Action/Invoker.php(78): Fusio\\Engine\\Processor->execute()\n#2 /var/www/html/fusio/vendor/fusio/impl/src/Controller/ActionController.php(60): Fusio\\Impl\\Service\\Action\\Invoker->invoke()\n#3 /var/www/html/fusio/vendor/fusio/impl/src/Framework/Filter/ActionExecutor.php(77): Fusio\\Impl\\Controller\\ActionController->execute()\n#4 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Framework\\Filter\\ActionExecutor->handle()\n#5 /var/www/html/fusio/vendor/fusio/impl/src/Controller/Filter/Logger.php(60): PSX\\Http\\Filter\\FilterChain->handle()\n#6 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Controller\\Filter\\Logger->handle()\n#7 /var/www/html/fusio/vendor/fusio/impl/src/Controller/Filter/RequestLimit.php(63): PSX\\Http\\Filter\\FilterChain->handle()\n#8 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Controller\\Filter\\RequestLimit->handle()\n#9 /var/www/html/fusio/vendor/fusio/impl/src/Controller/Filter/Authentication.php(57): PSX\\Http\\Filter\\FilterChain->handle()\n#10 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Controller\\Filter\\Authentication->handle()\n#11 /var/www/html/fusio/vendor/fusio/impl/src/Controller/Filter/Operation.php(91): PSX\\Http\\Filter\\FilterChain->handle()\n#12 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Controller\\Filter\\Operation->handle()\n#13 /var/www/html/fusio/vendor/fusio/impl/src/Controller/Filter/Tenant.php(57): PSX\\Http\\Filter\\FilterChain->handle()\n#14 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): Fusio\\Impl\\Controller\\Filter\\Tenant->handle()\n#15 /var/www/html/fusio/vendor/psx/http/src/Filter/UserAgentEnforcer.php(43): PSX\\Http\\Filter\\FilterChain->handle()\n#16 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): PSX\\Http\\Filter\\UserAgentEnforcer->handle()\n#17 /var/www/html/fusio/vendor/psx/http/src/Filter/CORS.php(86): PSX\\Http\\Filter\\FilterChain->handle()\n#18 /var/www/html/fusio/vendor/psx/http/src/Filter/FilterChain.php(86): PSX\\Http\\Filter\\CORS->handle()\n#19 /var/www/html/fusio/vendor/psx/framework/src/Loader/Loader.php(97): PSX\\Http\\Filter\\FilterChain->handle()\n#20 /var/www/html/fusio/vendor/psx/framework/src/Loader/Loader.php(72): PSX\\Framework\\Loader\\Loader->execute()\n#21 /var/www/html/fusio/vendor/psx/framework/src/Dispatch/Dispatch.php(86): PSX\\Framework\\Loader\\Loader->load()\n#22 /var/www/html/fusio/vendor/psx/engine/src/WebServer/Engine.php(51): PSX\\Framework\\Dispatch\\Dispatch->route()\n#23 /var/www/html/fusio/vendor/psx/framework/src/Environment/Environment.php(49): PSX\\Engine\\WebServer\\Engine->serve()\n#24 /var/www/html/fusio/public/index.php(29): PSX\\Framework\\Environment\\Environment->serve()\n#25 {main}",
    "context": "63          $qb-&gt;setParameter(&#039;id&#039;, $id);\n64  \n65          $row = $connection-&gt;fetchAssociative($qb-&gt;getSQL(), $qb-&gt;getParameters());\n66          if (empty($row)) {\n<b>67              throw new StatusCode\\NotFoundException(&#039;Entry not available&#039;);\n</b>68          }\n69  \n70          $data = $this-&gt;convertRow($row, $connection, $table, $mapping);\n71  \n"
}

When I change the operation path to /v10/xxx?yyy=1223 there is no error.

I don't know why it's trying to check a SQLSelectRow as it's a SQLQueryRow action.

I tried to clean the database from every call to the /v1 call but it's useless

The last version of the container I used was the 5.1.5 and if I revert to this version, it's working correctly

noctaia avatar Feb 12 '25 11:02 noctaia

Hi @andy3469, can you show me the JSON config of the /v10/xxx operation, which you can see at the backend s.

Image

chriskapp avatar Feb 12 '25 18:02 chriskapp

Sorry for the delay, here is both json of the one working and the one not working (I just changed the path and name for security).

{
  "id": 235,
  "status": 1,
  "name": "v1.test.get",
  "scopes": [
    "admin",
    "test"
  ],
  "active": true,
  "public": false,
  "stability": 1,
  "httpMethod": "GET",
  "httpPath": "/v1/test/get",
  "httpCode": 200,
  "parameters": {
    "startIndex": {
      "type": "integer"
    },
    "testInteger": {
      "type": "integer"
    },
    "testString": {
      "type": "string"
    }
  },
  "outgoing": "schema://V1_Test_SQL_Get",
  "throws": {},
  "action": "action://V1_Test_SQL_GetAlt"
}
{
  "id": 237,
  "status": 1,
  "name": "v10.test.get",
  "scopes": [
    "admin",
    "test"
  ],
  "active": true,
  "public": false,
  "stability": 1,
  "httpMethod": "GET",
  "httpPath": "/v10/test/get",
  "httpCode": 200,
  "parameters": {
    "startIndex": {
      "type": "integer"
    },
    "testInteger": {
      "type": "integer"
    },
    "testString": {
      "type": "string"
    }
  },
  "outgoing": "schema://V1_Test_SQL_Get",
  "throws": {},
  "action": "action://V1_Test_SQL_GetAlt"
}

noctaia avatar Feb 18 '25 15:02 noctaia

ok, so I'am trying to understand the problem, is it possible for me to reproduce this error in a plain new Fusio installation? Also can you show me the config of the V1_Test_SQL_GetAlt action and the underlying CREATE TABLE statement of the table.

chriskapp avatar Mar 01 '25 17:03 chriskapp

If I create a new Fusio installation and I import the backup and the connection, the error is still there with the /v1/ path and not with the /v10/ path. fusio_backup.json

But if I create a new Fusio installation and I do everything manually it work correctly.

Here is the V1_Test_SQL_GetAlt:

{
  "id": 6,
  "status": 1,
  "name": "V1_Test_SQL_GetAlt",
  "class": "Fusio.Adapter.Sql.Action.Query.SqlQueryRow",
  "async": false,
  "config": {
    "sql": "SELECT * FROM testTable\r\nWHERE testString = {testString}\r\n    OR testInteger = {testInteger}",
    "connection": "4"
  },
  "date": "2025-03-04T13:28:56Z"
}

And the CREATE TABLE:

CREATE TABLE IF NOT EXISTS `testTable` (
  `sn` varchar(50) NOT NULL DEFAULT '',
  `testString` varchar(50) NOT NULL DEFAULT '',
  `testInteger` bigint(20) unsigned NOT NULL DEFAULT 0,
  `creation` datetime NOT NULL,
  `hard` text NOT NULL,
  `test_ref` text NOT NULL,
  `soft` text NOT NULL,
  `expedition` datetime DEFAULT NULL,
  `client` text DEFAULT NULL,
  `validation` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`sn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

noctaia avatar Mar 04 '25 13:03 noctaia