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

[bug] POST to /api/v1/account returns 200 but with an empty body #3733

Open
alimoeeny opened this issue Feb 4, 2025 · 1 comment
Open

[bug] POST to /api/v1/account returns 200 but with an empty body #3733

alimoeeny opened this issue Feb 4, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@alimoeeny
Copy link

Describe the bug with a clear and concise description of what the bug is.

I need to create accounts using the /api/v1/account API.

A POST to this endpoint with a payload like this (this is not the EXACT payload, but close enough):

{
    "username":"xk063c2xa3insqw3n4nj_sb_persona",
    "email":"[email protected]",
    "password":"20 char long mix of upper lower special and digits",
    "reason":"a long enough explanation of why I am doing api calls",
    "agreement": true,
    "locale: "en-US"
}

returns a 200 status with an empty body.

I expected to get a json response in the body like the following (per docs at https://docs.gotosocial.org/en/latest/api/swagger/ )

{
  "access_token": "string",
  "created_at": 1627644520,
  "scope": "read write admin",
  "token_type": "bearer"
}

Looking at the logs for the server I see the following panic that was "captured":

timestamp="04/02/2025 13:39:52.895" func=server.init.func1.Logger.13.1 level=ERROR stacktrace="()\n\t/usr/local/go/src/runtime/panic.go:261\nruntime.sigpanic()\n\t/usr/local/go/src/runtime/signal_unix.go:881\nuser.(*Processor).TokenForNewUser()\n\t/dro
ne/src/internal/processing/user/create.go:150\naccounts.(*Module).AccountCreatePOSTHandler()\n\t/drone/src/internal/api/client/accounts/accountcreate.go:121\n()\n\t/drone/src/vendor/github.com/gin-gonic/gin/context.go:185\ngzip.(*gzipHandler).Handle()\
n\t/drone/src/vendor/github.com/gin-contrib/gzip/handler.go:60\n()\n\t/drone/src/vendor/github.com/gin-gonic/gin/context.go:185\nmiddleware.Throttle.func2()\n\t/drone/src/internal/middleware/throttling.go:144\n()\n\t/drone/src/vendor/github.com/gin-gon
ic/gin/context.go:185\n" requestID=qn931mcm04000ft75qng msg="recovered panic: runtime error: invalid memory address or nil pointer dereference"

I have NOT beed doing a lot of calls (maybe one per 10 minute or so).

Any help will be appreciated.

What's your GoToSocial Version?

GoToSocial 0.17.3+git-6f4cb2f

GoToSocial Arch

Linux, binary, not docker

What happened?

received an 200 status but empty body

What you expected to happen?

receive a json object with an access token in the response body

How to reproduce it?

it is reproducible on my server, I'd be happy to demonstrate it or give you access to try it if you canno reproduce it on your side.

Anything else we need to know?

No response

@alimoeeny alimoeeny added the bug Something isn't working label Feb 4, 2025
@tsmethurst
Copy link
Contributor

Thanks! Will take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants