Back-End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:

Title: URL Shortener Microservice – Test 3 fails even though redirect works

Title: URL Shortener Microservice – Test 3 fails even though redirect works

Hello everyone,

I’m currently working on the URL Shortener Microservice project from the Back End Development and APIs certification.

My application seems to work correctly:

  • I can POST a URL to /api/shorturl

  • The API returns the correct JSON response with original_url and short_url

  • When I visit /api/shorturl/1, the app correctly redirects to the original URL

However, FreeCodeCamp test #3 still fails:

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

I tested the redirect directly in the browser and it works as expected.

Project links:

Live project:
https://proyecto2-1e09.onrender.com

Source code:
https://github.com/gerardojaracarrasco-droid/proyecto2

Example:

  1. POST request to:
/api/shorturl

Body:

url=https://google.com

Response:

{
  "original_url": "https://google.com",
  "short_url": 1
}

  1. Visiting:
/api/shorturl/1

Correctly redirects to https://google.com.

Despite this, the FreeCodeCamp test still marks test #3 as failed.

Has anyone experienced the same issue or knows if this might be a problem with the test runner?

Thanks in advance!

sometimes the test will log an error to the console in the browser when it runs.
Can you check and see if such a thing is getting logged and if yes, what does it say?

This is what it throws at me

1 Like

my guess is the file dom-test-evaluator.js is an fCC file. It’s probably broken.

1 Like

however, maybe you want to try the test in a browser that doesn’t have any extensions just in case one of your extensions is the reason for the failure


Well… it’s still not working. I’ll keep trying to change the code and keep testing with Firefox.

1 Like

facing the same error despite many tries

Welcome to the forum @mahtabhassan159 !

Please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Help button image located on each challenge. This will automatically import your code in a readable format and pull in the challenge URL while still allowing you to ask any question about the challenge or your code.

Thank you.

Happy coding!

there is no point in creating a new topic in this case as the issue is likely on the fCC side, and no new information will be given in response.

Is there a GitHub issue for this?

Edit: Nevermind; think I found it.