Skip to content

TypeError: Cannot read property 'method' of null #2

@oledybedokken

Description

@oledybedokken

const JSONstat = require("jsonstat-toolkit");

var url="https://data.ssb.no/api/v0/dataset/1054.json?lang=en";
JSONstat(url).then(main);
function main(j){
var ds=j.Dataset(0);
console.log(ds)
}

This returns error:
let method = init.method || input.method || 'GET';
^

let method = init.method || input.method || 'GET';
^

TypeError: Cannot read property 'method' of null
at new Request (/app/node_modules/node-fetch/lib/index.js:1217:21)
at /app/node_modules/node-fetch/lib/index.js:1439:19
at new Promise ()
at fetch (/app/node_modules/node-fetch/lib/index.js:1437:9)
at module.exports (/app/node_modules/jsonstat-toolkit/main.cjs:2:15410)
at Object. (/app/index.js:2:1)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions