Conversation
kdembler
left a comment
There was a problem hiding this comment.
Quick first round of feedback after testing:
Error handling
I think we should introduce some kind of errorCode to make it easier to distinct between different error types. Currently if some validation is failed error is always Bad request, we could repurpose that to create some list of unique error codes to map to specific errors.
For example, if my channel doesn't meet some criteria I will see:
{
"statusCode": 400,
"message": "Channel UCCs9_brR2ADhDVuhrVTjKfQ with 0 subscribers does not \n meet Youtube Partner Program requirement of 100 subscribers",
"error": "Bad Request"
}This is problematic because:
a) to understand what kind of error happened we need to do message string matching which can be risky if error message changes in the future
b) we need to parse the message to understand what is the requirement (100 subscribers)
Another issue is that when verifying the eligibility, code will return error on first error found. However, to properly present the status to the user we actually need to see all the failing criteria, not just the first one.
I would suggest error format along those lines:
{
"errors": [
{
"errorCode": "CHANNEL_CRITERIA_UNMET_SUBSCRIBERS",
"message": "Channel UCCs9_brR2ADhDVuhrVTjKfQ with 0 subscribers does not meet Youtube Partner Program requirement of 100 subscribers",
"subscribers": 0,
"requiredSubscribers": 100
},
{
"errorCode": "CHANNEL_CRITERIA_UNMET_VIDEOS",
"message": "Channel UCCs9_brR2ADhDVuhrVTjKfQ does not meet Youtube Partner Program requirement of at least 10 videos, each 1 month old",
"videos": 3,
"requiredVideos": 10
}
]
}Let me know how you think feasible this is.
Issues
- When I query
/users/{userId}/videosI get 500 server error - When I query
/channels/{id}, what is the ID that should be passed here? Seems whatever I pass (I tried user ID, joystream channel ID) I get back
{
"statusCode": 400,
"message": "The number of conditions on the keys is invalid"
}- When I query
/usersI get 500 server error
Addressed error changes as suggested in the review
Fixed
Fixed. You should pass the Joystream ChannelId as parameter. I have updated the description
Fixed |
kdembler
left a comment
There was a problem hiding this comment.
The API still fails to start if it fails to connect to RPC endpoint. The worst thing about it is that it fails silently and doesn't really indicate that the app failed to start. We should do one of the following:
a) Make the app work without a successful RPC connection, since that isn't really needed at the moment (for the YPP scope)
b) Make it clear that the app failed to load because of failed RPC connection
|
Also noticed that if I call |
Addressed. Now API won't crash on Node version > 14
Fixed. |
kdembler
left a comment
There was a problem hiding this comment.
Additional points:
- Seems this wasn't resolved? I still see the same behavior
Also noticed that if I call verify (I will get my YT email back) and then call verify-and-save with different email, the different email is not saved and my user still has the YT email attached when I query /users
Fixed.
- We discussed changing the endpoints 👇 Did you decide to skip this after all?
/users/verify would be just POST to /users as this call creates a user (it also saves some data, not just verifies)
/users/verify-and-save would be POST to /channels as this call creates an entry in /channels list
|
|
||
| // YPP induction criteria, each channel should meet following criteria | ||
| const MINIMUM_SUBSCRIBERS_COUNT = 50 | ||
| const MINiMUM_VIDEO_COUNT = 10 |
There was a problem hiding this comment.
Typo, should be MINIMUM, all caps
| message: | ||
| `Channel ${channel.id} with ${channel.statistics.videoCount} videos does not meet Youtube ` + | ||
| `Partner Program requirement of at least ${MINiMUM_VIDEO_COUNT} videos, each 1 month old`, | ||
| result: channel.statistics.videoCount, |
There was a problem hiding this comment.
I think this should return videos.length instead, right?
| errorCode: ExitCodes.CHANNEL_CRITERIA_UNMET_VIDEOS, | ||
| message: | ||
| `Channel ${channel.id} with ${channel.statistics.videoCount} videos does not meet Youtube ` + | ||
| `Partner Program requirement of at least ${MINiMUM_VIDEO_COUNT} videos, each 1 month old`, |
There was a problem hiding this comment.
each 1 month old should use MINIMUM_VIDEO_AGE_MONTHS
| errorCode: ExitCodes.CHANNEL_CRITERIA_UNMET_CREATION_DATE, | ||
| message: | ||
| `Channel ${channel.id} with creation time of ${channel.publishedAt} does not ` + | ||
| `meet Youtube Partner Program requirement of channel being at least 3 months old`, |
There was a problem hiding this comment.
at least 3 months old should use MINIMUM_CHANNEL_AGE_MONTHS
Sorry, there was an issue in the previous fix. Now resolved
Overlooked that before. Now resolved, now |
kdembler
left a comment
There was a problem hiding this comment.
Looks good to me, great job!
implements
YoutubeSync
Required Stack
Enter
localhost:3001/docsto view all api endpoints and their descriptionsFor user verification flow only two endpoints are needed
/users/verify/users/verify-and-saveRunning the app
Install dependencies
yarnDeploy all the necessary infrastructure
This script deploys the relevant dynamoDB tables for needed for the verifications flow.
yarn nx run api:serveThis will start the YPP backend service at localhost:3001
yarn nx run app:serveOpen the browser window at localhost:4200 to interact with the app. Click
VERIFY YOUR YOUTUBE CHANNELbutton to start the verification flow. If verification is successful the YPP will respond back withemailanduserIdof the verified user. (See response type for/users/verifyendpoint atlocalhost:3001/docs).After that the frontend app need to prepare the request for save the verified channel to the YPP backend state. There is no UI for that so, you can use any api client(e.g. Postman) for making request to
users/verify-and-savewith provided values ofuserId,joystreamChannelId,email, and optionalreferrerId