Attempting to use Amplify in an Appsync Typescript custom handler not working #13982
Open
3 tasks done
Labels
feature-request
Request a new feature
GraphQL
Related to GraphQL API issues
pending-maintainer-response
Issue is pending a response from the Amplify team.
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
The text was updated successfully, but these errors were encountered: