There is already a construct with name 'xyz' in 'abc' #24615
-
I am getting this error even though I have made sure that there are no duplicate id names. Any idea what I might be doing incorrectly. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In your class Please view our CDK Workshop to see an example of how to create a custom construct. This isn't related to your issue, but the pattern you have of creating a class which isn't a construct is a bit unorthodox 🙂 |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
In your class
GenericTable
, the constructor callsinitialize()
which callscreateTable()
. Afterinitialize()
ends, you callcreateTable()
again in the constructor. This creates two tables with the same supplied ID, causing this error.Please view our CDK Workshop to see an example of how to create a custom construct. This isn't related to your issue, but the pattern you have of creating a class which isn't a construct is a bit unorthodox 🙂