-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Checklist
- I have looked into the README and have not found a suitable solution or answer.
- I have looked into the documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have upgraded to the latest version of this SDK and the issue still persists.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
I'm trying to run a Bulk User Import with 1 user, so I create the JSON in-memory and pass it to a bytes.NewReader. This is rejected by the Auth0 Management API with an error:
{"statusCode":400,"error":"Bad Request","message":"Payload validation error: 'Invalid multipart payload format'.","errorCode":"invalid_body"}
Expectation
I expect to be able to send any io.Reader to the mgmtClient.Jobs.UsersImports.Create, and it should start an import job.
Reproduction
The following two import-jobs are rejected.
job := &management.CreateImportUsersRequestContent{
ConnectionID: "some connection ID",
Upsert: ptr(true),
SendCompletionEmail: ptr(false),
Users: bytes.NewReader([]byte(`[{"user_id":"123"}]`)),
}
jobImportUserResp, err := ams.mgmtClient.Jobs.UsersImports.Create(ctx, job)or
job := &management.CreateImportUsersRequestContent{
ConnectionID: "some connection ID",
Upsert: ptr(true),
SendCompletionEmail: ptr(false),
Users: strings.NewReader(`[{"user_id":"123"}]`),
}
jobImportUserResp, err := ams.mgmtClient.Jobs.UsersImports.Create(ctx, job)If I read the content from a File by using os.Open, or if I wrap the reader in a struct that also implement the Name() string function, then it works as expected.
Auth0 Go SDK version
v2.2.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working