Use the .env File challenge on Vercel won't work

I did everything I possibly could to check it as many times as possible as to why it won’t work. Now, I finally moved to replit temporarily just to pass the test.

Just want to inform anyone who’d come across this post that it won’t work no matter what you do on Vercel. Please correct me if I am wrong.

Just want to add that implementing a root-level request logger middleware would also result into an error in vercel.

Links of challenges not working on Vercel:

  1. Basic Node and Express - Use the .env File | Learn | freeCodeCamp.org
  2. Basic Node and Express - Implement a Root-Level Request Logger Middleware | Learn | freeCodeCamp.org

It wouldn’t work out of the box. You probably can make it work but you would need to understand how Vercel works and rewrite it. I think the biggest obstacle might be the testing dependency package.

There are other sites that let you deploy traditional Node/Express code.

1 Like

Updated links of challenges not working on Vercel:

  1. Basic Node and Express - Use the .env File | Learn | freeCodeCamp.org
  2. Basic Node and Express - Implement a Root-Level Request Logger Middleware | Learn | freeCodeCamp.org
  3. Project: URL Shortener Microservice

As said above, you need to do some research and work to get these challenges to work on Vercel. Did you start this research/work yet?

1 Like

Yes. It just won’t work. Or maybe I just lack the know-how no matter how I try.

If u have time to check can you help regarding replit as well? In vercel it won’t run at all, but now even in replit it is running, my Url Shortener project, the 2nd and 3rd tests still keep on failing.

Here’s my replit link: https://boilerplate-project-urlshortener.jmrecodes.repl.co/

And here’s the tests:

I finally found the error. The code won’t correctly check for http://site.com/ but will on http://site.com

Updated links of challenges not working on Vercel:

  1. Basic Node and Express - Use the .env File | Learn | freeCodeCamp.org
  2. Basic Node and Express - Implement a Root-Level Request Logger Middleware | Learn | freeCodeCamp.org
  3. Project: URL Shortener Microservice
  4. Project: Exercise Tracker
  5. Project: File Metadata Microservice

Did you look at how Vercel works? Do you understand the difference between a normal Node.js server and using their serverless functions?

Saying it doesn’t work is misleading. You can likely do most of the certificate projects but I haven’t tried. Here is the file metadata microservice running on Vercel.

https://file-metadata-microservice-vercel.vercel.app

1 Like

My search on how vercel works might have been too limited, since I really don’t have any idea how your file metadata microservice on vercel worked. I also don’t really have significant knowledge on node.js (I’ve only learned node thru the course) and vercel’s serverless functions or serverless in general.

Sorry for saying it won’t work when you clearly made it work. What I meant was how other challenges and projects worked with a simple (beginner-friendly) setup on vercel, but the ones listed above won’t.

This was my vercel.json:

{
“version”: 2,
“builds”: [
{
“src”: “./index.js”,
“use”: “@vercel/node”
}
],
“routes”: [
{
“src”: “/(.*)”,
“dest”: “/index.js”
}
]
}

Can you share yours?

Here is the repo for it.

https://github.com/lasjorg/file-metadata-microservice-vercel

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.