Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 when collecting MSOA level rolling rate data via axios and api endpoint within nodejs code #550

Open
jjoslin-SCC opened this issue Dec 30, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jjoslin-SCC
Copy link

As the title suggests I am trying to pull MSOA level endpoint data via axios within nodejs, as described by the api's documentation.

The error message has been attached within a .txt file

Code used:

const axios = require("axios");
const surreyRates_endpoint = (
    `https://api.coronavirus.data.gov.uk/v1/data?` +
    `filters=areaType=msoa;areaCode=E02006427` +
    `&structure={"date":"date","rate":"newCasesBySpecimenDateRollingRate"}`
);
const surreyRates_getData = async ( url ) => {
    const { data, status, statusText } = await axios.get(url, { timeout: 20000 });
    if ( status >= 400 )
        throw new Error(statusText);
    return data
};  // getData
const surreyRates_main = async () => {
    const result = await surreyRates_getData(surreyRates_endpoint);
    const data_values = Object.values(result)[3];
    console.log(data_values)
};  // main
surreyRates_main().catch(err => {
    console.error(err);
    process.exitCode = 1;
});

Module is being tested on a windows 10 machine
Final combined back end code will be run of a windows 2019 server

The module will be looped over a number of MSOAs within surrey, but for simplicity, code for just a single MSOA has been provided. If there is a flaw in my code please advise, however this code template has worked for all other modules within our larger conglomerate of back end code.

Error_500.txt

@statsgeekclare statsgeekclare added the bug Something isn't working label Feb 23, 2022
@UKHSA-Internal UKHSA-Internal deleted a comment from statsgeekclare Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants