serverpod / serverpod

Serverpod is a next-generation app and web server, explicitly built for the Flutter and Dart ecosystem.
BSD 3-Clause "New" or "Revised" License
2.53k stars 237 forks source link

issue with setUserImage on serverpod_auth_client module #2331

Open tylersavery opened 4 months ago

tylersavery commented 4 months ago

Describe the bug When hitting the client.modules.auth.user.setUserImage(image), a 400 error is being returned.

To Reproduce Steps to reproduce the behavior:

  1. Add the serverpod_auth_client module
  2. Convert an image to bytes
  3. Use the client.modules.auth.user.setUserImage(image) function

Expected behavior 200 Success (with a boolean of true or false coming back)

Serverpod versions

Platform information I've tried on iOS and web with the same results.

Additional context I believe this could be related to server.dart in the core framework. See the block starting at line 269. At 287, there is a null override (!) on the value body, but body can technically be null if await _readBody(request); comes back null.

This likely isn't the root of the problem but something I identified while stepping through.

Additionally, I'll add, I have tried this with both the built in storage AND the S3 module.

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ServerpodClientException: , statusCode = 400
#0      ServerpodClient.callServerEndpoint (package:serverpod_client/src/serverpod_client_io.dart:73:9)
<asynchronous suspension>
#1      _SettingsScreenState.build.<anonymous closure>.<anonymous closure> (package:spmc_flutter/src/screens/settings_screen.dart:96:45)
<asynchronous suspension>
SandPod commented 4 months ago

Hey @tylersavery!

Thanks for the report. What logs are you getting from the Server when processing this request? If you run the server with --logging=verbose, do you get any additional information printed then as well?

Please post the server logs if possible :)

binemmanuel commented 2 months ago

Hey @tylersavery!

Thanks for the report. What logs are you getting from the Server when processing this request? If you run the server with --logging=verbose, do you get any additional information printed then as well?

Please post the server logs if possible :)

I experienced the same thing and here are the logs

received request: POST /serverpod_auth.user
handleRequest: POST /serverpod_auth.user
2024-08-22 17:33:32.242890Z Internal server error. Zoned exception.
Null check operator used on a null value
#0      Server._handleRequest (package:serverpod/src/server/server.dart:296:48)
<asynchronous suspension>

ServerPod 2.0.2 Dart 3.4.4 (stable) macos_arm64