fiskaltrust/product-de-bring-your-own-datacenter

Internal Server Error from Initial Operation Receipt (FiskalyCertified (Fiskaly V2))

BraveButter opened this issue ยท 6 comments

Describe the bug
500 Internal Server Error on Initial Operation Receipt for a FiskalyCertified (Fiskaly V2) SCU

To Reproduce
Steps to reproduce the behavior:

  • Create a SCU fiskaltrust.Middleware.SCU.DE.FiskalyCertified (1.3.24)
  • Create a Queue fiskaltrust.Middleware.Queue.MySQL (1.3.24)
  • Use them together in a cashbox (select SCU for Queue, rebuild etc.)
  • Send sign request with correct header for the cashbox and as body
{
   "ftCashBoxID": "0b26f1e6-6681-4683-a8a4-4f545fb962fe",
   "ftPosSystemId": "cb2f540b-346d-418a-9b63-3abaee6f46bd",
   "cbTerminalID": "001",
   "cbReceiptReference": "INIT",
   "cbReceiptMoment": "{{current_moment}}",
   "cbChargeItems": [],
   "cbPayItems": [],
   "ftReceiptCase": 4919338172267102211,
   "cbUser": "Admin"
}
  • Response empty body -> 500 Internal Server Error

Screenshot 2021-11-03 at 14 59 59

Expected behavior

  • Reponse should be ok
  • Queue should be active in the fiskaltrust portal
  • Sign requests afterwards should generate a vaild signature

Helm Chart Version
Screenshot 2021-11-03 at 15 06 36

STDOUT/STDERR
If applicable, add LogOutput from affected BackendPOD.

{
    "log": "\u001b[41m\u001b[30mfail\u001b[39m\u001b[22m\u001b[49m: fiskaltrust.Middleware.SCU.DE.Fiskaly.FiskalySCU[0]\n      Failed to execute SetTseStateAsync - Request: {\"CurrentState\":1}\n      { Status: \"-20000\", Error: \"Bad Request\", Code: \"\", RequestId: \"a512137a813024f028b24eb25a554d9e\" }\n",
    "stream": "stdout",
    "kubernetes": {
        "pod_name": "byodc-77c95794c9-ss49q",
        "container_name": "byodc",
        "docker_id": "818b4af1721bacf2e3a6350344be85f113f07c6a62bb601fe0852ea134946597",
        "container_image": "ghcr.io/fiskaltrust/byodc-mysql-fiskaly:1.3-buster"
    }
}
{
    "log": "\u001b[41m\u001b[30mfail\u001b[39m\u001b[22m\u001b[49m: fiskaltrust.Middleware.Queue.SignProcessor[0]\n      { Status: \"-20000\", Error: \"Bad Request\", Code: \"\", RequestId: \"a512137a813024f028b24eb25a554d9e\" }\n",
    "stream": "stdout",
    "kubernetes": {
        "pod_name": "byodc-77c95794c9-ss49q",
        "container_name": "byodc",
        "docker_id": "818b4af1721bacf2e3a6350344be85f113f07c6a62bb601fe0852ea134946597",
        "container_image": "ghcr.io/fiskaltrust/byodc-mysql-fiskaly:1.3-buster"
    }
}
{
    "log": "\u001b[41m\u001b[30mfail\u001b[39m\u001b[22m\u001b[49m: fiskaltrust.SignatureCloud.DE.Controllers.SignController[0]\n      0b26f1e6-6681-4683-a8a4-4f545fb962fe: Failed to execute sign for cashbox.\n      { Status: \"-20000\", Error: \"Bad Request\", Code: \"\", RequestId: \"a512137a813024f028b24eb25a554d9e\" }\n",
    "stream": "stdout",
    "kubernetes": {
        "pod_name": "byodc-77c95794c9-ss49q",
        "container_name": "byodc",
        "docker_id": "818b4af1721bacf2e3a6350344be85f113f07c6a62bb601fe0852ea134946597",
        "container_image": "ghcr.io/fiskaltrust/byodc-mysql-fiskaly:1.3-buster"
    }
}
{
    "log": "\u001b[41m\u001b[30mfail\u001b[39m\u001b[22m\u001b[49m: Microsoft.AspNetCore.Server.Kestrel[13]\n      Connection id \"0HMCUOU10E79D\", Request id \"0HMCUOU10E79D:00000002\": An unhandled exception was thrown by the application.\n      { Status: \"-20000\", Error: \"Bad Request\", Code: \"\", RequestId: \"a512137a813024f028b24eb25a554d9e\" }\n",
    "stream": "stdout",
    "kubernetes": {
        "pod_name": "byodc-77c95794c9-ss49q",
        "container_name": "byodc",
        "docker_id": "818b4af1721bacf2e3a6350344be85f113f07c6a62bb601fe0852ea134946597",
        "container_image": "ghcr.io/fiskaltrust/byodc-mysql-fiskaly:1.3-buster"
    }
}

POSSystem (please complete the following information):

  • POSSystemID: cb2f540b-346d-418a-9b63-3abaee6f46bd

Cashbox Information (please complete the following information):

  • CashboxID: 0b26f1e6-6681-4683-a8a4-4f545fb962fe

Additional context
The Echo request for the cashbox works and reload the config with it doesn't change anything.
All other cashboxes we tried with Fiskaly V2 has the same problem.

Hi @BraveButter,
thanks for reporting this issue and all the details! The error messages you posted are generated by a fiskaly v1 SCU - is it possible that something was mixed up here? If it was a fiskaly v2, the namespace throwing the error would be fiskaltrust.Middleware.SCU.DE.FiskalyCertified.FiskalySCU (instead of fiskaltrust.Middleware.SCU.DE.Fiskaly.FiskalySCU).

Fiskaly also had a partial outage last week, therefore it might be worth to retry the initialization, if possible.

Finally, I noticed that you're testing in the production Portal, and not in the sandbox - is this intentional?

Hey @BraveButter,

It seems your byodc pods are still running on an old image.

please perform an upgrade of the helm release using helm upgrade --install ... and if this does not help try these instructions Restart of all cashboxes.

The error { Status: \"-20000\", Error: \"Bad Request\", Code: \"\", RequestId: \"a512137a813024f028b24eb25a554d9e\" } which is returned from fiskaly indicates, that the pods are starting the SCU as a V1 SCU.

You can check the MW version of the byod pods via the /api/version endpoint which should indicate a version larger than 1.3.22 for fiskaly V2 to work.

Hi @volllly,
after double checking the helm version (i've made the upgrade to v1.3.24 last week but this should be fine i guess)

โžœ  ~ helm status bring-your-own-datcenter --namespace=fiskaltrust

NAME: bring-your-own-datcenter
LAST DEPLOYED: Wed Nov  3 13:42:03 2021
NAMESPACE: fiskaltrust
STATUS: deployed
REVISION: 5
โžœ  ~ helm search repo fiskaltrust                                
NAME                                 	CHART VERSION	APP VERSION	DESCRIPTION
fiskaltrust/bring-your-own-datacenter	1.3.24    

and restarting all cashboxes (restart all pods)

โžœ  ~ kubectl get all -n fiskaltrust                              
NAME                                                             READY   STATUS    RESTARTS   AGE
pod/bring-your-own-datcenter-ambassador-5cb7d96f5c-jnt2x         1/1     Running   0          12d
pod/bring-your-own-datcenter-ambassador-5cb7d96f5c-qjnkd         1/1     Running   0          12d
pod/bring-your-own-datcenter-ambassador-agent-669c79f6b-8x5p4    1/1     Running   0          12d
pod/bring-your-own-datcenter-ambassador-redis-5fdc977f89-rkqx6   1/1     Running   0          112d
pod/byodc-fcfc9c966-lspnn                                        1/1     Running   0          12m
pod/byodc-fcfc9c966-m9b6k                                        1/1     Running   0          11m
pod/byodc-fcfc9c966-mvqff                                        1/1     Running   0          11m
pod/byodc-fcfc9c966-sfds4                                        1/1     Running   0          12m
pod/byodc-fcfc9c966-tt5zx                                        1/1     Running   0          11m
pod/byodc-fcfc9c966-wjsm2                                        1/1     Running   0          12m
pod/redis-69d445ff55-wmsh6                                       1/1     Running   0          112d

the output from the /api/version is still not the one it needs to be

[
    "fiskaltrust.SignatureCloud.DE",
    "1.0.0",
    "api:v1"
]

This seems to be a problem with your Kubernetes setup. It should normally automatically pull the latest image (See https://kubernetes.io/docs/concepts/containers/images/#imagepullpolicy-defaulting Omit the imagePullPolicy and use :latest as the tag for the image to use; Kubernetes will set the policy to Always when you submit the Pod).

You can try manually setting the image tag to the latest version in the config.yaml:

byodc:
  image:
    tag: 1.3.25-buster

you can find the available versions here https://github.com/fiskaltrust/product-de-bring-your-own-datacenter/pkgs/container/byodc-mysql-fiskaly

Sorry for the late answer, we had some trouble because of the changes from 1.3.18 to the 1.3.25 about the ftSignatureFormatFlag.
Setting the version hard coded worked for now.
I think we need to investigate further into the imagePullPolicy as you described.
But this should be handled in another issue if necessary.

Thanks for your help.

thanks for letting us know ๐Ÿ™