awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Failed compiling GraphQL schema: Your GraphQL Schema is using "@connection" directive from an older version of the GraphQL Transformer. #339

Closed cfzimmerman closed 1 year ago

cfzimmerman commented 2 years ago

Describe the bug

Following Amplify Video docs to try it out on a test project: https://docs.amplify-video.com/docs/Video-on-Demand/Getting-Started-with-VOD Allowing "Video Add" to create a new GraphQL API generates a model containing an @ connection, which Amplify flags as outdated, preventing deployment of any Amplify Video resources. The offending @ connection line is directly preceded by a DO NOT EDIT comment. Is this an item that needs to be updated from the Amplify Video side, or can I just adjust the written relationship to be consistent with GraphQL transformer v2? If so, what relationship is best?

Also, replacing the @ connection with a v2 relationship like @ hasOne bypasses this error but brings me to this error next: https://github.com/aws-amplify/amplify-cli/issues/3480. Unsure if they're related. There's also an Amplify depreciation warning present, but, again, unsure if that's wrapped up in this.

To Reproduce

  1. Set up project: Create bare Expo app (Javascript); create new Amplify App via AWS console; deploy basic Auth, Storage, and Data Model via Amplify Studio; pull to local environment; configure boilerplate UI for functional authentication
  2. npm i amplify-category-video -g
  3. Amplify video add

Video-On-Demand Friendly Name: testvideovod Default HLS Adaptive Bitrate Notifications: N Production: N Do you want Amplify to create a new GraphQL API to manage your videos (Beta): Y Permission schema: Any authenticated users can upload videos Do you want to override your GraphQL schema: N

Expected behavior

GraphQL compiles so that "amplify push" can be used to generate cloud resources.

Versions:

Screenshots

amplify/backend/api/testvideo/schema.graphql

schema-graphql

@ connection error

@connection-error

userpools error

userpools-error

*** Extra spaces are added between GraphQL @ relationships in this bug report to avoid @-ing other GitHub users with those usernames.

luciano-schirmer commented 2 years ago

Based on GraphQL Transformer v1 to v2 migration, we should probably need to change the video:VideoObject @connections to video:VideoObject @hasOne.

But this still gives the same error message in my machine.

luciano-schirmer commented 2 years ago

A workaround is to replace the following auth rules:

@auth(
  rules: [
    {allow: public, groups:["Admin"], operations: [create, update, delete, read]},
    {allow: private, operations: [read]}
  ]
)

by this:

@auth(
  rules: [
    {allow: public, operations: [read]}
  ]
)

At least I was able to proceed with no errors.

cfzimmerman commented 1 year ago

Works beautifully. Thank you!