fission-codes / fission-server

Apache License 2.0
9 stars 0 forks source link

fix: /account hangs #229

Closed hugomrdias closed 8 months ago

hugomrdias commented 8 months ago

sending incomplete payloads makes endpoint timeout

request.json.post(new URL('/api/v0/account', this.#baseUrl), {
      body: {
        email: 'hugomrdias@gmail.com',
        code: '123456',
      },
    })

Should return a validation error, the same way it return an error if i add a username but not include credentials (UCAN)

matheus23 commented 8 months ago

To reproduce this, do I need to attach valid UCANs?

hugomrdias commented 8 months ago

no

matheus23 commented 8 months ago

I can't reproduce this with curl locally:

$ curl -X POST --data '{"email":"test@gmail.com","code":"123456"}' "http://localhost:3000/api/v0/account" --verbose
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying [::1]:3000...
* connect to ::1 port 3000 failed: Connection refused
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000
> POST /api/v0/account HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 42
> Content-Type: application/x-www-form-urlencoded
> 
< HTTP/1.1 401 Unauthorized
< content-type: application/json
< content-length: 83
< access-control-allow-origin: *
< vary: origin
< vary: access-control-request-method
< vary: access-control-request-headers
< request_id: 01HNDHMRZHM19Q9363677A30TW
< date: Tue, 30 Jan 2024 16:01:12 GMT
< 
* Connection #0 to host localhost left intact
{"errors":[{"status":"401","detail":"Missing credentials","title":"Unauthorized"}]}
matheus23 commented 8 months ago

Also tried curl -X POST -H "Content-Type: application/json" -d '{"email":"test@gmail.com","code":"123456"}' "http://localhost:3000/api/v0/account"

matheus23 commented 8 months ago

Turns out this was an issue with something unrelated. Discussed & fixed in internal discord (https://discord.com/channels/478735028319158273/479089899539267585/1201924465899094127).