Skip to content

Issue with resource.ts in Amplify Gen2 #2

@hasanradi93

Description

@hasanradi93

Hello,

I've been following your project (and your YouTube video) and have written the code as per your instructions. However, I'm encountering a problem with resource.ts in amplify/data. Upon checking the documentation, I noticed that the script for creating a schema has been updated. I modified my code accordingly, but when I try to get or add posts, I encounter an issue with post.list() and post.create(). The error message is:

"Error: Cannot read properties of undefined (reading 'list')"

I discovered that I need to update the models in amplify_outputs.json, which seemed to resolve the initial issue. However, I'm now receiving a new error:

"Error: No api-key configured" (If I need to add an apiKey inside amplify_outputs.json, where can I obtain this apiKey and where should I place it? Should it go under the auth object?)
I couldn't find any information in the documentation on how to resolve this. Could you please provide guidance on how to fix this issue?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions