QA Converter FCC Tests Timing Out

Tell us what’s happening:
My metric ↔ imperial converter is passing all tests except for those which check for my tests.

All 16 unit tests are complete and passing. (Test timed out)
All 5 functional tests are complete and passing. (Test timed out)

I noticed in the developer console that it might be CORS related:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://calm-sea-41276.herokuapp.com/_api/get-tests. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

However, I thought that the files from the FCC Github boilerplate repo would handle the CORS for me (as it’s installed the npm package cors and in server.js I see the line app.use(cors({origin: '*'})); //For FCC testing purposes only).

Another thread suggested installing a browser plugin to add said Access-Control-Allow-Origin headers, however, then Heroku logs give a timeout application error (code H12), even though the console error about CORS is gone.

I tried adding comments to the fcctesting.js file to figure out how far it goes without a problem (not that I understand most of the code there, but thought it might possibly be helpful?)

And I triple-checked that the NODE_ENV variable had been set on Heroku as well.

Your project link(s)

solution: https://calm-sea-41276.herokuapp.com
githubLink: https://github.com/deina-k/boilerplate-project-metricimpconverter

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0

Challenge: Metric-Imperial Converter

Link to the challenge:

1 Like

hey deina,

your app works fine for me, no CORS issues. (I tested your deployed version on Heroku with my browser).

I guess your problem is with the functional unit tests. Do you run your unit tests against the deployed service or do you use a test client?

best
Dennis

Hey,

Thanks for the reply; not sure what you mean with your question. I did them the same way we were taught earlier in the curriculum: my code for the functional tests is here.

The CORS issue (or request timeout) seems to appear only when trying to access /_api/get-tests

I tried moving on to the next project in hopes that someone would help me with this one later, and ran into similar problems:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://calm-hollows-40191.herokuapp.com/api/issues/fcc-project. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

This one’s not even the endpoint for tests, and I’ve barely started on the project. I’m starting to suspect this has something to do with the boilerplate code from the FCC Github repo for the projects…?

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