HELP URL Shortener: first POST of the test doesn't have a GET

Hello!

I made a simple app that stores the urls in a json file and it does work with any webpage I enter (only now do I see a lot of you used mongo to store them). But when I try the code, I get this wrong:

“3. When you visit /api/shorturl/<short_url>, you will be redirected to the original URL.”

And when I went to see what urls were being entered in the test I got this:

[

{

"original_url": "http://localhost:3000/?v=1778199201422",

"short_url": 1

},

{

"original_url": "http://localhost:3000/?v=1778199201488",

"short_url": 2

}]

How do I work around this? How do I deal with that kind of url? Since it gets stored, the program does accept it, but it does not seem to “give it back” because of the name. I understand I should return freeCodeCamp’s localhost and not mine, but I don’t know how to fix it.

My code is here: GitHub - AndieAtWork/Tmp: temporary code storage · GitHub

Thank you in advance!

I realized this wasn’t the problem, I’m updating later!

You’ll have to contact the FCC support if you feel everything is right because they had to mock the browser’s fetch API to get around some CORS issues, and that ended up breaking some tests for their legacy backend projects.

Hi everyone,

I’m working on the URL Shortener Microservice project and I found something strange while debugging the FCC tests.

My app correctly stores the URLs, but the first automated test still fails. After adding traces, I noticed that the test runner creates the first short URL with a POST request, but never follows up with the GET request to check the redirect. The second attempt works normally.

Here’s the relevant trace:

So the redirect is only tested for short_url: 2, never for short_url: 1.

I wanted to ask if this is a known issue with the tests or if anyone found a workaround.

I’m having an issue with the URL Shortener project tests in the Backend Development and APIs certification.

From my debugging traces, it looks like the automated test sends a POST request to create the shortened URL, but during the first test case it never performs the corresponding GET request to verify the redirect. Because of that, the first attempt fails even though the URL is correctly saved.

Here is the trace output:

Notice that only the second shortened URL receives the GET request (RECEIVED: 2).

Has anyone else experienced this? Could this be an issue with the test suite itself?

Here’s my code GitHub - AndieAtWork/Tmp: temporary code storage · GitHub

Thank you

Thank you! I’m contacting support right now

Here’s a link to how I traced the actual problem:

I’m doing the archived course!

hi, I’ve combined all your posts into one topic as we do not want people to open multiple topics about the same issue.

As this course is archived, there is nothing we can do to help. It is no longer supported so issues from fCC’s side will not be getting fixed.

They have the new backend course I think or at least working on it. The updates will be there. They recommend you do the new one.

My institute removed this course from the mandatory courses to be done. Thank you for the support.

I think there was an update on this topic last week

https://github.com/freeCodeCamp/freeCodeCamp/pull/65879

just keep in mind, the course is archived. If someone volunteers a fix, and then it breaks again for some other reason, one should not expect any fixes.

that commit should have been deployed, so if the fix worked, now the archived backend challenges should be submittable