ObjectId in must be a single string of 12 bytes or a string of 24 hex characters on reloading the product page

Hey there everyone,
I was following the jumpstart ecommerce tutorial with mongo db, and I encountered this problem.

When I click on the card and go to the product page it works fine, but when i reload the product page it returns an error:`Error: ObjectId in must be a single string of 12 bytes or a string of 24 hex characters

The realm function for getting the product:

exports = function(arg){



    let collection = context.services.get("mongodb-atlas").db("store").collection("products");
  

  return collection.findOne({_id:BSON.ObjectId(arg)})};

Thank you for taking your time out to read this question.

Jumpstart Jumpstart - YouTube
Screen Recording of the issue: Screen Recording 2022-05-11 at 12.08.41 PM.mov - Google Drive

Regards,
Vaarun Sinha

1 Like

Did you find a resolution? Anyone from Mongo can chime in?