Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cfn generate - TypeError: unhashable type: 'OrderedSet' #192

Open
x6j8x opened this issue Mar 24, 2021 · 8 comments
Open

cfn generate - TypeError: unhashable type: 'OrderedSet' #192

x6j8x opened this issue Mar 24, 2021 · 8 comments

Comments

@x6j8x
Copy link

x6j8x commented Mar 24, 2021

Hi,

we have a "oneOf" entry in our model and I suspect this to be culprit (but I don't know for sure).

With older versions of cfn-cli and the go-plugin this is generated just fine. But it breaks for 2.0.4 with the error above.

Complete stacktrace:

[2021-03-24T10:24:47Z] DEBUG    - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/rpdk/core/cli.py", line 100, in main
    args.command(args)
  File "/usr/local/lib/python3.9/site-packages/rpdk/core/generate.py", line 15, in generate
    project.generate()
  File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 408, in generate
    self._plugin.generate(self)
  File "/usr/local/lib/python3.9/site-packages/rpdk/go/codegen.py", line 171, in generate
    contents = template.render(models=models)
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.9/site-packages/rpdk/go/templates/types.go.tple", line 15, in top-level template code
    {{ name|uppercase_first_letter }} {{ type|translate_type }} `json:",omitempty"`
  File "/usr/local/lib/python3.9/site-packages/rpdk/go/resolver.py", line 40, in translate_type
    return "*" + PRIMITIVE_TYPES[resolved_type.type]
TypeError: unhashable type: 'OrderedSet'
@SuperMohit
Copy link

SuperMohit commented Nov 29, 2022

@x6j8x Were you able to fix this issue?

@x6j8x
Copy link
Author

x6j8x commented Nov 29, 2022

@SuperMohit Kind of… We pinned 2.0.3 and as this repo is more dead than alive, that’s not the worst solution. ymmv 🤷‍♂️

@SuperMohit
Copy link

@SuperMohit Thanks for the reply.

@SuperMohit
Copy link

@x6j8x You mean 1.0.3 right?

@x6j8x
Copy link
Author

x6j8x commented Nov 29, 2022

I can’t remember the exact circumstances (it’s been a long time), but we actually pin 2.0.3.

pip3 install -q --upgrade cloudformation-cli-go-plugin==2.0.3

@SuperMohit
Copy link

@x6j8x Thanks it works with 2.0.3.

@FlorianSW
Copy link

Just tried out 2.0.4 with the latest cloudformation-cli version (0.2.28 I believe), and this error seems to magically have disappeared. (I just checked that out to get rid of the invalid_create contract test from aws-cloudformation/cloudformation-cli#734).

@SuperMohit
Copy link

actually for my case, even with 2.0.3, although contract test passed but on deploying template it would throw extraneous key all over. So had to remove polymorphic props.

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

No branches or pull requests

3 participants