Open mmixan opened 2 weeks ago
Hi @mmixan we're still in the process of adding model based graphql operations support for lambda. in the meantime, we have this documentation for accessing your graphql api using a client.graphql
approach rather than client.models
.
please follow this doc and let us know if you run into any issues:
i've marked this as a feature request and will circle back once we release it
Wish I had seen this post 2 days ago. Spent some several hours on this. Looking forward for the updated doc.
Thank you @chrisbonifacio !
I had seen that doc before, but was hoping there was something easier to work with.
I spent some time with that article the other day and it made sense, but I am struggling a bit with one line:
endpoint: env.<amplifyData>_GRAPHQL_ENDPOINT, // replace with your defineData name
Can you give a concrete example of what that would look like in practice? I have the generated code exported into a folder near the custom handler, but I am not following how to get to the URL in doc. Thanks!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
auth, api
Backend
Amplify Gen 2
Environment information
Describe the bug
I have been working with the new Gen 2 Amplify stuff recently and really liking it. I am specifically working on trying to move into custom handlers for the Appsync/GraphQL stuff to add custom business logic into those operations.
From the front-end, everything works fine when using code like
client.models.XXX.get
orclient.mutations.XXX
, but when I attempt to use those things in my custom handler I am having problems.First, I tried this approach:
This works great in development but throws the following errors during build:
I tried using TS ignore approaches and tried relative and absolute path changes but nothing seemed to allow the code to find the
amplify_outputs.json
file during build.So next, using https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/connect-bedrock/ as an example, I was attempting to remove the need for
Amplify.configure()
in the Handler, so I moved to a solution like this:This allows the build to work, but during runtime I receive the following error in the browser console:
Expected behavior
I would expect either of the above solutions to work, because either the
amplify_outputs.json
file is available during build and runtime, or that theamplify_outputs.json
file is not required in the handler and therefore code is not required at runtime to initialize Amplfy.Reproduction steps
Code Snippet
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