#✅ - Configuration for Electron Aps

1 messages · Page 1 of 1 (latest)

steel crescent
#

Hi everyone,

I'm working on an Electron project and I'm trying to integrate AWS Amplify for GraphQL operations. However, I'm encountering an issue when running the following function:

export async function getTodos() {
  try {
    const { data, errors } = await client.models.Todo.list();
    console.log("List todo errors", errors);
    console.log("List todo data", data);
    return { data, errors };
  } catch (error) {
    console.log("Error listing todos", error);
    return { error };
  }
}

I keep getting the following error in the main process:

Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.

Here are the steps I've taken so far:

  1. I've called Amplify.configure() with the appropriate configuration in my project.
  2. I've verified that the configuration includes the GraphQL provider details.

Despite these steps, the error persists. Has anyone faced a similar issue or could provide guidance on properly configuring and using AWS Amplify in an Electron project? Any help would be greatly appreciated!

Thanks in advance!

foggy panther
#

Hi @steel crescent I'm not familiar with Electron but when you verfied that the config has GraphQL provider details, did you check the amplify_outputs.json file or did you use Amplify.getConfig() before the request to make sure the config was updated in the Amplify instance?

This page might also be helpful but it is tailored to React apps specifically

https://docs.amplify.aws/react/build-a-backend/troubleshooting/library-not-configured/#check-1-validate-that-amplifyconfigure-is-called-in-the-root-of-your-project

steel crescent
#

Yes, I did. Running the same function in the renderer process returns the expected result.

oblique muralBOT
#

✅ - Configuration for Electron Aps