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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Christopher O’Brien](https://secure.gravatar.com/avatar/4a26fb1f14c5560309751b4b8ae750a2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Christopher O’Brien
5,120 PointsThere was an error getting the profile for chalkers. (Unauthorized)
When trying to request /chalkers information I receive this message: "There was an error getting the profile for chalkers. (Unauthorized)"
var Profile = require("./profile.js");
function home (req, res){
if (req.url === "/") {
res.writeHead(200, {'Content-type':'text/plain'});
res.write("Home header\n");
res.end("Goodbye");
}
}
function user (req, res) {
var username = req.url.replace("/", "");
if(username.length > 0) {
res.writeHead(200, {'Content-type':'text/plain'});
res.write("Profile Header\n");
var studentProfile = new Profile(username);
studentProfile.on("end", function(profileJSON) {
var values = {
avatarUrl: profileJSON.gravatar_url,
username: profileJSON.profile_name,
badges: profileJSON.badges.length,
javaScriptPoints: profileJSON.points.JavaScript
}
res.write(values.username + " has " + values.badges + " badges\n");
res.end('Profile Footer\n');
});
studentProfile.on("error", function(error){
res.write(error.message + "\n")
res.end('Footer\n');
});
}
}
module.exports.home = home;
module.exports.user = user;
Steven Parker
230,688 PointsSteven Parker
230,688 PointsOther parts of the projected needed to replicate the issue are not included here.
To share the entire project, use the snapshot function in the workspace and provide the link to that.