Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Retrieving Entries from a Table

article.publishedAt is not a function

When I want to list all articles I get this error:

article.publishedAt() article.publishedAt is not a function TypeError: /Users/acandael/Tutorials/javascript-tech-degree/sequelize_blog/views/articles/by_line.jade:4 2| = article.author 3| | |

4| = article.publishedAt()

I double checked the code in the models file, but I can't find any typos: .... instanceMethods: { publishedAt: function() { return dateFormat(this.createdAt, 'dddd, mmmm dS, yyyy, h:MM TT'); }, shortDescription: function() { return this.body.length > 30 ? this.body.substr(0, 30) + '...' : this.body; } }

Anyone else got this error?

Steven Parker
Steven Parker
241,807 Points

Could you provide a link to a workspace snapshot?

5 Answers

@Steven I pushed my code to github:

https://github.com/acandael/sequelize-blog

the error I get is:

TypeError: /Users/acandael/Tutorials/javascript-tech-degree/sequelize_blog/views/articles/by_line.jade:4

thanks for your help!

greetings,

Anthony

Steven Parker
Steven Parker
241,807 Points

The repo is good for just sharing the code, but a workspace allows you to share the complete environment which makes it easy to replicate the issue. Otherwise, someone must first try to reproduce the build environment, which might be a significant task if they are not already working with the same project or one that uses all the same libraries.

I recreated the code in a workspace and I'm getting the same error. My workspace is at:

http://port-3000-3ixwtgt1cm.treehouse-app.com/articles

greetings,

Anthony

Steven Parker
Steven Parker
241,807 Points

That's just the preview URL. To share the workspace itself, make a snapshot of your workspace and post the link to that here.

the link of my snapshot is:

https://w.trhou.se/q6dmibsj4w

Hey Anthony, did you ever sort this out? I'm getting the exact same error.

I'm getting a similar error. Here is a snapshot of my workspace. https://w.trhou.se/mjf1wsjw43

I've found an answer at https://teamtreehouse.com/community/es6-question, as suggested by Lee V.