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

failed to create user #16

Open
alonlong opened this issue Jan 26, 2020 · 7 comments
Open

failed to create user #16

alonlong opened this issue Jan 26, 2020 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@alonlong
Copy link

alonlong commented Jan 26, 2020

Hi, This is my golang code:

uuid := id2uuid(id)
fmt.Println(uuid)

userRequest := fusionauth.UserRequest{
	SendSetPasswordEmail: false,
	SkipVerification:     true,
	User: fusionauth.User{
		SecureIdentity: fusionauth.SecureIdentity{
			Password:         "123456",
			EncryptionScheme: "salted-md5",
		},
		Email: "xxxxxx@xx.com",
	},
}
userReply, _, err := auth.CreateUser(uuid, userRequest)
if err != nil {
	panic(err)
}
fmt.Printf("%v\n", struct2JSON(userReply))

when I run this code, the result:
50166975-0100-0000-0516-796758492463
{"statusCode":400,"user":{}}

what's the problem?

@robotdan
Copy link
Member

robotdan commented Jan 26, 2020

@matthew-altman it looks like we are not de-serializing into the errors object on a non 2xx response.

Can you take a look?

@alonlong if you recreate using postman , insomnia or some rest client the JSON body response on a 400 will tell you what the validation error is that is causing the request to fail.

@robotdan robotdan added the bug Something isn't working label Jan 26, 2020
@matthew-altman
Copy link
Contributor

@alonlong It looks like you're throwing away the Errors, the second return value, from the auth.CreateUser() call. Can you please store that value and reply with the results of that? Thanks!

@matthew-altman
Copy link
Contributor

@alonlong Were you able to resolve this issue? Or do you have any additional error messages for us?

@matthew-altman matthew-altman added question Further information is requested and removed bug Something isn't working labels Feb 26, 2020
@michaeldabbott
Copy link

michaeldabbott commented May 12, 2020

Pretty sure this is related to the issue I'm having currently.

A request to CreateUser returns zero validation errors but err is equal to EOF.
This is also occurs when you have a user who hasn't set a password yet and they try and login, no validation errors will be returned but err will be equal to EOF.
It'll also occur when a user tries to login who doesn't have an account instead of just returning a 401.

Any current work arounds? Happy to post any additional findings too.

@robotdan
Copy link
Member

@abbottm-go if you try to make the same request using a REST client such as insomnia or postman what is the error and status code?

If we can identify the actual error - then we should be able to recreate the scenario and symptom to resolve the core issue.

Thanks!

@michaeldabbott
Copy link

@robotdan

The status code is 200 when err is equal to EOF on the login function. That's using insomnia. This occurs with both the Login and CreateUser functions.

using go 1.14.2 :)

@michaeldabbott
Copy link

michaeldabbott commented May 12, 2020

@robotdan
`
response, error, err := a.fusionAuth.CreateUser("", request)

if error != nil || err != nil {
	return nil, err
}
return response, nil

`

the err object is the one defaulting to EOF & errors object is just an empty map

@robotdan robotdan assigned mooreds and unassigned matthew-altman Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants