Can't submit from github repo subdirectory

Tell us what’s happening:

I created a freecodecamp repo in github and am putting the different fcc projects in subdirectories so I don’t have dozens of top level fcc repos cluttering up my github account - especially the smaller things that wouldn’t be things worth deploying at the end. From what I can tell, freecodecamp seems to have out-clevered itself in trying to work around the URL that I’m submitting. I’m not allowed to use links yet, so here are the pieces that you need to find my github repo:
username = mich-cook
repo = freecodecamp
directory = boilerplate-npm

I’ve tried submitting URLs for the subdirectory, the file, and the raw version of the file that has absolutely nothing to fetch except for the text of the file.

I’ve used online JSON and package.json validators that say the JSON is valid, but the package.json file is bad because it doesn’t have a version. If I remove my author field, then it warns that that should exist as well.

The tests run, but the result is incorrect. I get this:
// running tests
package.json should have a valid “author” key
// tests completed

Your code so far

is in the github repo. not allowed to post a link to it yet.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.149 Chrome/80.0.3987.149 Safari/537.36.

Challenge: undefined

Link to the challenge:

Maybe there’s some other verification bug.

glitch URLs don’t seem to work either. I probably can’t paste URLs still, so here are my glitch keywords:
opalescent-resonant-modem

I clicked on the glitch link from fcc. I added the author field that I copied directly from fcc and pasted into glitch. I took the URL from glitch and put it back into the fcc solution url field.

Still fail. I’ve minimized my involvement in the process to almost nothing and still getting errors. It’s not to be ruled out, but I hope I’m not this dumb! :slight_smile:

are you choosing the live app link?
README-md – elfin-bronzed-deposit 4-4-2020 15-26-57

2 Likes

You need to host your project somewhere and give that link to the FCC validator. You cannot give the link to the codebase. May be try Github pages, but I use Glitch

@ILM that was indeed the issue with using glitch. it’s confusing how this is working since the package.json file isn’t part of what’s being served. when the task is to validate a package.json file, it seems much more reasonable to link to that file.

but if you don’t give the live code app link, how could the tests test it?
that is the direct link to your live app

@ILM this unit appears to focus completely on the package.json file. This file is not exposed in the output of the product and it would be a huge security risk if it was.

A live app does not (and should not) have a direct way to test what’s in a package.json file. The live glitch app displays some markup that’s not related to the current challenge, does not include any text of the package.json file, and has no link to the package.json file.

It would seem that the only way that FCC currently can verify that an author field has been added (challenge #1) is to take the URL of the glitch page, disassemble it, reassemble a glitch project URL that includes the filename, grab the file from there, then validate it.

If a direct link to the package.json file is allowed, almost all of this extra work is trimmed and FCC can test the JSON file the same way just as easily. The challenge asks for a link to the solution then literally rejects almost any link that goes directly to the actual solution.

Hi @mich-cook The logic for FCC validator is written in the server.js file. If you are interested in you can have a look.
There you can find below code

app.route('/_api/package.json')
  .get(function(req, res, next) {
    console.log('requested');
    fs.readFile(__dirname + '/package.json', function(err, data) {
      if(err) return next(err);
      res.type('txt').send(data.toString());
    });
  });

So it basically servers your package.json file in url _api/package.json. If you navigate to this path in your live app, you can see your package.json file. FCC validator is using this path to test the content of package.json file.

What you say is true but they have intentionally exposed it since this is a learning example app :slightly_smiling_face:

@acskck thanks for pointing out how this happens. slightly different than what I guessed, but ironically the URL that you dug out ( /_api/package.json ) is also rejected as a bad solution.


It’s still odd that boilerplate-npm appears to be a repo that does nothing but create a server whose only purpose is to create an intentional security violation to serve the only file that’s used in the whole “Managing Packages” chapter that could be validated any number of other ways.

So this side path is “resolved”, I suppose, but it sounds like my original question - how to validate answers from a github repo - has no answer since there is no way to do it.