amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

No auth provider found for auth mode function

Open dustin-auby opened this issue 1 year ago • 6 comments

Description

Hi all, i am trying to use a Lambda function for Lambda authorization mode in amplify and i get the following error.

underlyingException": "ConfigurationError {\n \"message\": \"No auth provider found for auth mode function.\",\n \"recoverySuggestion\": \"Ensure API plugin correctly configured.\"\n}

I have created the function, set the authentication mode to Lambda but when querying i get that error. if i run the query from appsync it works fine.

bellow is the model i am using

type Attendants @model @auth(rules: [{ allow: custom, provider: function }]) { id: ID! event_uuid: ID! @primaryKey(sortKeyFields: ["id"]) name: String surname: String json: AWSJSON json_string: String }

If anyone can assist with this i would be very greatfull

Categories

  • [ ] Analytics
  • [ ] API (REST)
  • [X] API (GraphQL)
  • [X] Auth
  • [X] Authenticator
  • [ ] DataStore
  • [ ] Notifications (Push)
  • [ ] Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • [ ] iOS
  • [X] Android
  • [ ] Web
  • [X] macOS
  • [ ] Windows
  • [ ] Linux

Flutter Version

3.10.3

Amplify Flutter Version

^1.6.0

Deployment Method

Amplify CLI

Schema

type Attendants @model @auth(rules: [{ allow: custom, provider: function }]) {
  id: ID!
  event_uuid: ID! @primaryKey(sortKeyFields: ["id"])
  name: String
  surname: String
  json: AWSJSON
  json_string: String
}

dustin-auby avatar Jan 30 '24 20:01 dustin-auby

I have manage to resolve this, turns out you cannot have 2 AmplifyAPI Objects, i was using one for api and one for the Lambda function. i merged the two and now it works fine.

I am now however getting very slow response times even when not using the Lambda function.between 400 and 1500 ms is this normal ?

dustin-auby avatar Feb 01 '24 14:02 dustin-auby

Hi @dustin-auby, how are you measuring the response times from the Lambda function? Is the 400-1500ms for the full network affect or is it from the API?

khatruong2009 avatar Feb 01 '24 19:02 khatruong2009

I'm measuring the full trip from before till after the request. So it will have a bit higher latency but surely not that high

Sent from my Galaxy

-------- Original message -------- From: Kha Truong @.> Date: 2024/02/01 21:11 (GMT+02:00) To: aws-amplify/amplify-flutter @.> Cc: Dustin | Epicdev @.>, Mention @.> Subject: Re: [aws-amplify/amplify-flutter] No auth provider found for auth mode function (Issue #4411)

Hi @dustin-aubyhttps://github.com/dustin-auby, how are you measuring the response times from the Lambda function? Is the 400-1500ms for the full network affect or is it from the API?

— Reply to this email directly, view it on GitHubhttps://github.com/aws-amplify/amplify-flutter/issues/4411#issuecomment-1922040158, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJEJOYY6UPHEJGWR7CW7A6TYRPSEDAVCNFSM6AAAAABCR4GM4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSGA2DAMJVHA. You are receiving this because you were mentioned.Message ID: @.***>

dustin-auby avatar Feb 01 '24 19:02 dustin-auby

Since this happens even when you don't use a lambda function, are you using the GraphQL API on a model that doesn't have authorization?

khatruong2009 avatar Feb 01 '24 21:02 khatruong2009

Hi,

Both models are authenticated . One uses cognito pool with owner permissions and the other uses custom with the lambda function as I need more fine grain control.

Sent from my Galaxy

-------- Original message -------- From: Kha Truong @.> Date: 2024/02/01 23:40 (GMT+02:00) To: aws-amplify/amplify-flutter @.> Cc: Dustin | Epicdev @.>, Mention @.> Subject: Re: [aws-amplify/amplify-flutter] No auth provider found for auth mode function (Issue #4411)

Since this happens even when you don't use a lambda function, are you using the GraphQL API on a model that doesn't have authorization?

— Reply to this email directly, view it on GitHubhttps://github.com/aws-amplify/amplify-flutter/issues/4411#issuecomment-1922294329, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJEJOYYA753DYSKVPUJVTMLYRQDWDAVCNFSM6AAAAABCR4GM4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSGI4TIMZSHE. You are receiving this because you were mentioned.Message ID: @.***>

dustin-auby avatar Feb 02 '24 05:02 dustin-auby

Hi @dustin-auby, could the longer latency events be happening when credentials are expired and need to be refreshed? Could you capture the network traffic and share it with us so we can better diagnose the issue?

Something like this:

image

khatruong2009 avatar Feb 07 '24 17:02 khatruong2009

Hey @dustin-auby, I wanted to follow up to see if you were still having this issue or if you were able to get it solved.

khatruong2009 avatar Mar 18 '24 20:03 khatruong2009

Hi, yes i was still having the issues. i have since moved away from amplify as i found it to limiting in many areas.

dustin-auby avatar Mar 19 '24 05:03 dustin-auby