Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this plugin compatible with AmplifyGraphqlApi construct? #1

Open
harshit9715 opened this issue Apr 12, 2024 · 2 comments
Open

Is this plugin compatible with AmplifyGraphqlApi construct? #1

harshit9715 opened this issue Apr 12, 2024 · 2 comments

Comments

@harshit9715
Copy link

Hi, I read your blog and saw your plugin. I love it and I appreciate your work!

Here is what I am trying to do. I am not so much fan of amplify cli. but I really like the graphql transformer it offers.

So, I went to constructs.dev and started looking into alternate options and found @aws-amplify/graphql-api-construct.

I can use this in my CDK or sst.dev projects and get everything working.

const graphApi = new AmplifyGraphqlApi(stack, "GraphqlApi", {
    definition: AmplifyGraphqlDefinition.fromFiles(
      "stacks/amplify-schema.graphql"
    ),
    apiName: "GraphqlApi",
    translationBehavior: {},
    transformerPlugins: [],
    authorizationModes: {
      apiKeyConfig: {
        expires: Duration.days(365),
        description: "API Key for GraphQL API - " + stack.stage,
      },
      defaultAuthorizationMode: "OPENID_CONNECT",
      oidcConfig: {
        oidcIssuerUrl: process.env.CLERK_ISSUER_BASE_URL!,
        oidcProviderName: "Clerk",
        tokenExpiryFromAuth: Duration.millis(0),
        tokenExpiryFromIssue: Duration.millis(0),
      },
    },
  });

I was trying to put the plugin config into transformerPlugins but I am unable to do it. It does not have types and I am not sure how to link it.

I would be glad if you can help me out with this if you can even guide me to some directions I can start from there. I have looked into amplify-category-api repo and your repo code with no luck so far.

Quick note if you are trying this out on yout CDK project.

set the context variable app.nodesetContext("amplifyEnvironmentName", "dev");

@olliethedev
Copy link
Owner

Hi @harshit9715,
This transformer was tested with AmplifyCLI, so by extension, it should technically work with the AmplifyGraphqlApi construct. However, I have not used the AmplifyGraphqlApi construct with the transformer directly. I will check this issue.
In the meantime, can you specify the exact error you are seeing when initializing the AmplifyGraphqlApi construct with the transformer?

@harshit9715
Copy link
Author

harshit9715 commented Apr 18, 2024

Hi @olliethedev , thank you for looking into this.

I did spent quite some time trying to make it work and spent countless hours exploring the amplify-category-api GitHub.

Eventually i pulled the code from your repo and used the CDK code directly to attach the transformer upon which I got the error Asset Manager is not initialised. I believe this error is from how the VTL templates are generated. My best guess is, its trying to load the plugin before the templates are generated.

This is a side project for me and I did learn quite a few tricks.

aws-amplify/amplify-category-api#2456
aws-amplify/amplify-category-api#2455
aws-amplify/amplify-category-api#2467 (this one has a video attached)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants