AmericanWhitewater / aw-ios

American Whitewater's iOS app
5 stars 2 forks source link

Legacy photo metadata field (Caption, etc) not loading #197

Open AWKevin opened 3 years ago

AWKevin commented 3 years ago

A new photo posted through the app shows the data, caption, etc fields. However the app is not loading those fields for photos already in the database.

AWKevin commented 1 year ago

I'll add that we need a comprehensive look into the photo API calls / functionality. Only a few photos from the website actually show up on the app at all, the metadata is off, and adding photos no longer works. This seems like it should be relatively low hanging fruit.

yeahphil commented 1 year ago

That sounds pretty broken! I’m certain adding photos worked when we last did a big update on the app — is this the API changing since then?

On Feb 13, 2023, at 8:09 AM, AWKevin @.***> wrote:

I'll add that we need a comprehensive look into the photo API calls / functionality. Only a few photos from the website actually show up on the app at all, the metadata is off, and adding photos no longer works. This seems like it should be relatively low hanging fruit.

— Reply to this email directly, view it on GitHub https://github.com/AmericanWhitewater/aw-ios/issues/197#issuecomment-1428211927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQGEN4IADUGQ2ZCVX6L6LWXJMDRANCNFSM4W2LCE3A. You are receiving this because you are subscribed to this thread.

AWKevin commented 1 year ago

@ngottlieb is going to try to add a photo and see what happens on the site/server side.

ngottlieb commented 1 year ago

OK, I can confirm that uploading a photo via the app seems to be broken. The API interface hasn't changed, but the backend code overall certainly may have.

Here's the error I'm seeing on the PHP app log:

[2023-03-02 19:06:49] production.ERROR: The resource owner or authorization server denied the request. {"exception":"[object] (League\\OAuth2\\Server\\Exception\\OAuthServerException(code: 9): The resource owner or authorization server denied the request. at /var/www/americanwhitewater.org/vendor/league/oauth2-server/src/Exception/OAuthServerException.php:243)
[stacktrace]
#0 /var/www/americanwhitewater.org/vendor/league/oauth2-server/src/AuthorizationValidators/BearerTokenValidator.php(111): League\\OAuth2\\Server\\Exception\\OAuthServerException::accessDenied()
#1 /var/www/americanwhitewater.org/vendor/league/oauth2-server/src/ResourceServer.php(84): League\\OAuth2\\Server\\AuthorizationValidators\\BearerTokenValidator->validateAuthorization()
#2 /var/www/americanwhitewater.org/vendor/laravel/passport/src/Guards/TokenGuard.php(184): League\\OAuth2\\Server\\ResourceServer->validateAuthenticatedRequest()
#3 /var/www/americanwhitewater.org/vendor/laravel/passport/src/Guards/TokenGuard.php(131): Laravel\\Passport\\Guards\\TokenGuard->getPsrRequestViaBearerToken()
#4 /var/www/americanwhitewater.org/vendor/laravel/passport/src/Guards/TokenGuard.php(94): Laravel\\Passport\\Guards\\TokenGuard->authenticateViaBearerToken()
#5 /var/www/americanwhitewater.org/vendor/laravel/passport/src/PassportServiceProvider.php(285): Laravel\\Passport\\Guards\\TokenGuard->user()
#6 [internal function]: Laravel\\Passport\\PassportServiceProvider->Laravel\\Passport\\{closure}()
#7 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php(58): call_user_func()
#8 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php(60): Illuminate\\Auth\\RequestGuard->user()
#9 /var/www/americanwhitewater.org/vendor/nuwave/lighthouse/src/Support/Http/Middleware/AttemptAuthentication.php(45): Illuminate\\Auth\\RequestGuard->check()
#10 /var/www/americanwhitewater.org/vendor/nuwave/lighthouse/src/Support/Http/Middleware/AttemptAuthentication.php(30): Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AttemptAuthentication->attemptAuthentication()
#11 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AttemptAuthentication->handle()
#12 /var/www/americanwhitewater.org/vendor/nuwave/lighthouse/src/Support/Http/Middleware/AttemptAuthentication.php(32): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#13 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AttemptAuthentication->handle()
#14 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Routing/Router.php(687): Illuminate\\Pipeline\\Pipeline->then()
#16 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\\Routing\\Router->runRouteWithinStack()
#17 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Routing/Router.php(628): Illuminate\\Routing\\Router->runRoute()
#18 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Routing/Router.php(617): Illuminate\\Routing\\Router->dispatchToRoute()
#19 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Routing\\Router->dispatch()
#20 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#21 /var/www/americanwhitewater.org/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#23 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#25 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Session\\Middleware\\StartSession->handle()
#26 /var/www/americanwhitewater.org/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle()
#28 /var/www/americanwhitewater.org/app/Http/Middleware/PageHasCGLogoMiddleware.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\PageHasCGLogoMiddleware->handle()
#30 /var/www/americanwhitewater.org/app/Http/Middleware/Wh2oFormatMiddleware.php(29): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\Wh2oFormatMiddleware->handle()
#32 /var/www/americanwhitewater.org/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle()
#34 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#36 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle()
#38 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Pipeline\\Pipeline->then()
#40 /var/www/americanwhitewater.org/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#41 /var/www/americanwhitewater.org/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle()
#42 {main}
"}

I don't know enough about the iOS app / Laravel app interface to tell what caused this situation off the top of my head, maybe @ryangroth5 can chime in?

ngottlieb commented 1 year ago

Ah, I think I see what's going on.

I tried logging out and logging back in (i.e. generating a new oauth token) and now photo upload works for me. @AWKevin you should try the same.

If that's the answer, then maybe we need to figure out a way to expire user sessions or something?

ngottlieb commented 1 year ago

there is some weirdness in the interface after I successfully upload a photo (a number of bugs...) but I don't think that's what this issue is referring to overall...

AWKevin commented 1 year ago

OK after some struggling I got logged out and back in, and was able to post a photo.

This one: https://www.americanwhitewater.org/content/River/view/river-detail/1040/gallery/5BrUIDOkmRUeL0NsDqE4b

On the desktop site it appears in the Gallery but not as a Trip Report, so that is sort of an old UI concept, which I am OK with.

Like all photos on the app the Caption appears empty on the App even though it exists on the site. River level also says NA on the app though I set it, and does not appear on the site either. Date does not appear on the app but does on the site.