Closed makrasnov100 closed 3 years ago
Hey @makrasnov100, thanks for providing a detailed explanation of the issue you're experiencing.
The Amplify CLI does not yet support the @aws_lambda
directive, so it's not going to transpile the model you have in step 5 in the way you're expecting. You will need to add that annotation manually to the schema in the AppSync console. Make sure to add it to the model itself, as well as all queries, mutations, and subscription queries for that model, e.g., getEvidence
, listEvidences
, createEvidence
, onCreateEvidence
etc. There should also be a type ModelEvidenceConnection
in there - make sure to add the directive to that too.
The team is working on adding CLI support, so this is just a temporary stopgap measure until then.
Thanks for your response and the temporary workaround. Looking forward to this feature being supported by the CLI!
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication, GraphQL API
Amplify Categories
auth, api
Environment information
Describe the bug
Seeing the recent announcement about a lambda authorization mode in AppSync. And the recently merged PR , we wanted to try this solution for executing custom role permission logic.
However, using the lambda authorization method I get the following response when trying to execute any query.
If this feature is not yet supported I guess this bug report should become a feature request.
Expected behavior
I receive a response with all of the requested object data. Like so:
Reproduction steps
amplify function add
index.js
file to the followingvar util = require('util');
exports.handler = async (event) => { console.log("Running Role Checker Lambda..") console.log("Printing Event: ") console.log(util.inspect(event))
const response = { "isAuthorized": true, //for now allow all requests } return response; };
amplify push
againaws-exports.js
file note that the default authorization mode isAMAZON_COGNITO_USER_POOLS
Create a test function that calls the API with lambda authorization
Code Snippet
All snippets in reproduction steps
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response