Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

ERROR Error: Uncaught (in promise): Error: In order to initialize AWSAppSyncClient, you must specify url, region and auth properties on the config object or a custom link. #68

Open
osw4l opened this issue Jul 8, 2020 · 3 comments

Comments

@osw4l
Copy link

osw4l commented Jul 8, 2020

core.js:15510 ERROR Error: Uncaught (in promise): Error: In order to initialize AWSAppSyncClient, you must specify url, region and auth properties on the config object or a custom link. Error: In order to initialize AWSAppSyncClient, you must specify url, region and auth properties on the config object or a custom link. at new AWSAppSyncClient (client.js:159) at new AppsyncService (appsync.service.ts:14) at _createClass (core.js:22110) at _createProviderInstance (core.js:22077) at resolveNgModuleDep (core.js:22024) at NgModuleRef_.get (core.js:23130) at resolveDep (core.js:23629) at createClass (core.js:23493) at createDirectiveInstance (core.js:23316) at createViewNodes (core.js:24864) at resolvePromise (zone.js:831) at resolvePromise (zone.js:788) at zone.js:892 at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423) at Object.onInvokeTask (core.js:17430) at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422) at Zone../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195) at drainMicroTaskQueue (zone.js:601)

@RonStack
Copy link

I am also receiving this message...

@PeteM31
Copy link

PeteM31 commented Apr 18, 2021

Anyone figure this out?

@yilmazbingo
Copy link

I am getting same error. Did anyone figured out? here is my labmda function:

exports.handler = async (event, context, callback) => {
    const graphqlClient = new appsync.AWSAppSyncClient({
        url: process.env.API_TICTACTOE_GRAPHQLAPIENDPOINTOUTPUT,
        region: process.env.REGION,
        auth: {
            type: "AWS_IAM",
            credentials: {
                accessKeyId: process.env.AWS_ACCESS_KEY_ID,
                secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
                sessionToken: process.env.AWS_SESSION_TOKEN
            }
        },
        disableOffline: true
    });

    const mutation = gql`
        mutation createPlayer(
            $name: String!
            $cognitoID: String!
            $username: String!
            $email: AWSEmail!
        ) {
            createPlayer(
                input: { cognitoID: $cognitoID, email: $email, name: $name, username: $username }
            ) {
                id
            }
        }
    `;

    try {
        await graphqlClient.mutate({
            mutation,
            variables: {
                name: event.request.userAttributes.name,
                username: event.userName,
                cognitoID: event.request.userAttributes.sub,
                email: event.request.userAttributes.email
            }
        });
        callback(null, event);
    } catch (error) {
        callback(error);
    }
};

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

No branches or pull requests

4 participants