Cannot call get with undefined key / Post.get is not a function

On my local machine I am using the latest version of Discourse. When I attempt to add a reply within a topic, I get the following error message:

The post.get error occurs in this bit of code:

I did a console.log(post) to see what it contained and the result was an object that has a post number of (...) . EDIT: Clicking on (…) yielded 1.

Additionally, when I try to add a New Topic (within the pipeline or in a topic), I get the error:

Would anyone know how to rectify this? Thanks!

Are you sure post is an Ember object? Have you tried post.post_number?

Isolated it down to something in two of our plugins, both of which reopen the composer controller.

2 Likes

In my local development, working on a plugin, I get a similarly strange behavior with respect to the composer.

The create topic button works in my local discourse instance, but then if I try to add a new create topic button somewhere else (and add some code to make that happen), it messes up, and all create topic buttons throughout the (local) site stop working.

And I get this error:

Uncaught Error: Assertion Failed: The key provided to set must be a string or number, you passed undefined

This continues even if I remove the code I added that seemed to cause the error in the first place. That is, once I get this error, even if I return all the code back to the way it was before, the error keeps coming up anytime I want to hit the create topic button.

The only thing that, I think, makes the error goes away, is if I remove the file entirely where the new code was (so, not having the file there–seems to work; having the file there with no code in it–the error continues).

Does anyone have any idea about this? It’s been a big hindrance to my development.