Error in async POST Requests II exercise

From today I’m trying to do the async POST Requests II exercise (https://www.codecademy.com/courses/introduction-to-javascript/lessons/requests-ii/exercises/async-post-requests-ii) and it doesn’t let me move forward.

This is the code that rejects me in the first step, isn’t it okay?

const getData = async () => {}

I leave a screenshot below:

The platform indicates that there is a typo or syntax error with the message “Failed to test your code

I have already reset the exercise and tried to write in several ways and this error still appears :frowning:

But what is more strange to me is that when I put “view solution”, it returns the correct code to me, then I do a reset and put the code that had given me in the solution and the same error message is still shown :dizzy_face:

Is it a site bug? :persevere:

I don’t know what causes it, I reset my exercise since I already finished it and got the same error message. Even when pasting my original code back in.

I’ll move this thread to the bug report section

1 Like

Thanks, I hope it can be solved :slight_smile:

1 Like

I think this is a transient error, pops up every now and again but from what I’ve read in previous instances it kinda sorts itself. (It’s usually a temporary issue connecting to the CC backend.)

@nikos3194 - can you try again and let us know if you get the same error now? Thanks. :slight_smile:

1 Like

Even if I reset, it still appears, even when I put the code that suggests in the solution :worried:

Seeing the file tree of the internal browser, it shows the add-in “test.js” with the following source, which I suppose should be the origin of the problem :thinking:

I leave a copy:

console.log = function() {};
const assert = require('chai').assert;
const fs = require('fs');
const Structured = require('structured');

const code = fs.readFileSync('main.js', 'utf8');

describe('', function () {
  it('', function() {
    let structureOne = function() {
      const getData = async () => {}
    }

    let isMatchOne = Structured.match(code, structureOne);
    assert.isOk(isMatchOne, 'Did you declare `const getData` and assign it an arrow function using `async`?')
  });
});

I just checked and the system has accepted the complete exercise code now:

const getData = async () => {
try {
  const response = await fetch('https://api-to-call.com/endpoint', {
  method: 'POST',
  body: JSON.stringify({id: 200})
 })
if (response.ok) {
  const jsonResponse = await response.json()
  return jsonResponse;
}
throw new Error('Request failed!');
} catch (error)  {
  console.log(error)
}
}

Thanks for correcting the bug :smiley: