Referring to Amplify's @model DynamoDB tables from custom Lambda

Viewed 95

I have created a full-stack application using Amplify and my schema is mostly using the standard @model pattern - however, I am running into an issue where I have a single mutation that would need to fetch data from one of the automatically generated tables.

However, now my issue is that the table name will be formatted <WhatEverIPutIn>-<RandomString>-<Env>. I haven't, for the life of me, managed to find how I can refer to this in the custom lambda.

My mutation looks like this:

type Mutation {
  acceptInvite(hash: String): String @function(name: "acceptInvitation-${env}")
}

Simple enough, one would think - now the problem obviously is that the lambda has no knowledge of the table name. The problem exists in reverse as well - if I create a new table for the lambda, models can't read from it either.

If this is something silly I've done, I don't have any important data and recreating the database is a valid option.

Any ideas?

0 Answers
Related