Skip to content

TypeError: Cannot read property 'allow' of undefined #11

@TheUltimateCookie

Description

@TheUltimateCookie

Steps to Reproduce

  • npm i request robots-parse
  • Run the following code
const req = require('request');
req("https://optinmonster.com/robots.txt", (err, res, body) => {
if (err) {
   console.log("Robots Parser Error");
   console.error(err);
   return reply.code(404).send({
       error: "Couldn't find sitemap. Please provide sitemap URL",
    });
}

const { parser } = require("robots-parse");
const object = parser(body);
console.log(object);
console.log(object.sitemaps);
}
);
  • Input the following URL in request - https://optinmonster.com/robots.txt

After doing these, I got the following error

TypeError: Cannot read property 'allow' of undefined
and my node server crashed.

Please check

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions