Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The command failed: Cannot deserialize the current JSON - using seqcli #364

Open
ShortMVitesse opened this issue Sep 26, 2024 · 7 comments

Comments

@ShortMVitesse
Copy link

ive rolled my own ubuntu container with seqcli installed. this is the command im running.

seqcli apikey create -t seq-apikey -s http://seq.test.company.com -a *** -p Application=service-test

when i run this command from that container on my machine it works (and other variations of it) but i get the following error message from github actions every time it runs.

The command failed: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Seq.Api.Model.Inputs.ApiKeyEntity' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

Seq is running on a k8s pod.

im not sure where to look for the solution for this error. is there some logs i need to be looking at on the k8s pod?

thanks

@nblumhardt
Copy link
Member

Hi Matt, thanks for the message.

Are the seqcli and Seq versions identical? Running seqcli 2024.3 and Seq 2024.3, both in Docker (podman), the command works fine for me:

~> podman run --rm -it --network host datalust/seqcli:2024.3 apikey create -t test-api-key -s http://localhost:5341
48fixvLSKUp6zZ7npjdT
~> podman run --rm -it --network host datalust/seqcli:2024.3 apikey create -t test-api-key -s http://localhost:5341
HqdXv2jhvZWoJMsQbaZD
~> 

Another possibility is that the Seq container URL is incorrect, and so the CLI is hitting some other service which responds with a JSON array, though that does seem a bit less likely 🤔

@bytejunkie
Copy link

everything is tagged latest, but i might go back and set the versions explicitly and try again. i dont believe this to be the issue though, any other ideas?

what does seq log to on k8s that i'd see the request inbound?

@nblumhardt
Copy link
Member

I think this one will be GET /api/apikeys/template - this request is made before creating the key, or if the key's actually being created and the request failing afterwards, it'll be GET /api/apikeys/{id}.

@KodrAus
Copy link
Member

KodrAus commented Oct 30, 2024

Just coming back through some triage; it's been a while since we've had any activity on this one so I'll go ahead and close it, but please feel free to re-open if you're still hitting this issue.

@KodrAus KodrAus closed this as completed Oct 30, 2024
@ShortMVitesse
Copy link
Author

work has allowed me back onto this one and it's still an issue for us.

i only get this error when the container is running from github actions.
i can run the exact same container image locally and both the actions work, that is to list keys and create a new key.
im using the exact same command output from the logs of the container in gha.

ive updated to latest cli release, but have always been running 2024.3 both sides.

the only thing that i can think is that when github is obscuring the secret its doing something to it that the seq server doesnt like.
the reason i say this is that this is in the error

into type 'Seq.Api.Model.Inputs.ApiKeyEntity'

so this is clearly a message from the server, it clearly has a problem wth the api key.

is my logic sound?

seq isnt currently logging any requests to console, so im off to work out how to make it do that.

@ShortMVitesse
Copy link
Author

also another gem of info. two lines before i try to create the api key, i list api keys with the same name.

this line of code works fine, skipping the create command if a key already exists. I cant see any reason this shouldnt be shared, so this is the code we're using.

gist

@nblumhardt nblumhardt reopened this Nov 5, 2024
@nblumhardt
Copy link
Member

Thanks for looping back @ShortMVitesse.

The ApiKeyEntity type is this one: https://github.com/datalust/seq-api/blob/dev/src/Seq.Api/Model/Inputs/ApiKeyEntity.cs - it's the target type when deserializing a newly-created API key on the client.

I'll take another look, too 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants