aws-amplify / docs

AWS Amplify Framework Documentation
https://docs.amplify.aws
Apache License 2.0
478 stars 1.01k forks source link

Functions docs - Lots of missing - Important pieces! #5904

Open qwikag opened 10 months ago

qwikag commented 10 months ago

The main issue with this page is the process and guidance that it provides, it does not flow. Nor does if provide the reasoning of why we use different authorisation types. nor provide any commands to do the job, which a guide would normally come with.

This topic is fundamental one of the worst broken pieces of Amplify and needs a lot of attention, and tested in many different scenarios, so that the documentation can be understood by us all.

Also it refers to node-fetch 2, but then later show node-fetch 3.2.3, but this may be due to different languages, but it is unclear.

Regarding Authorisation types it is important to advise the public/private/owner/group capability here. What I found to be missing was what type is used with API_Key/IAM/Cognito, and How do each work? Lots of people online complain that this feature does not work, yet it is fundamental to getting any app working. WHy is SDK not installed by default, or part of the add function process.

Because this functionality is seriously broken, and causing a lot of havoc in many threads.

https://docs.amplify.aws/guides/functions/graphql-from-lambda/q/platform/js/#iam-authorization

Additionally: When the Node.js v18 runtime is released for Lambda this dependency can be removed in favor of native fetch To get started, add the node-fetch module as a dependency: What does this mean? 18 is now an older version so what's the deal???

qwikag commented 10 months ago

Maybe this can help...

After updating Auth with postAuthenmtication function. I then immediately installed in the functions src directory

npm install node-fetch@2 npm install @aws-crypto/sha256-js@2 npm install @aws-sdk/credential-provider-node@3 npm install @aws-sdk/protocol-http@3 npm install @aws-sdk/signature-v4@3

but instead of giving me these:

  • "dependencies": {
  • "@aws-crypto/sha256-js": "^2.0.1",
  • "@aws-sdk/credential-provider-node": "^3.76.0",
  • "@aws-sdk/protocol-http": "^3.58.0",
  • "@aws-sdk/signature-v4": "^3.58.0",
  • "node-fetch": "2"
  • },

in gave me:

"dependencies": { "@aws-crypto/sha256-js": "^2.0.2", "@aws-sdk/credential-provider-node": "^3.414.0", "@aws-sdk/protocol-http": "^3.374.0", "@aws-sdk/signature-v4": "^3.374.0", "node-fetch": "^2.7.0" }

Some versions are well out of date in the docs, so I chose the current version closest to them.