Starter files, final projects and FAQ for my Complete Node.js Bootcamp
  • bundle.js:6895 Uncaught ReferenceError: stripe is not defined

Payment session is working in the backend, but int the stripe.js file; but gives the error while callling Stripe function to create the session.

  • stripe.js file
    • import { showAlert } from './alert';
    • stripe = Stripe(''-----------);

hi there , i have a question about routing if i use routing in node js that means i dont need to make folders and files in my website ??

Was implementing the average ratings part, but get this error when updating or deleting the review. Code is almost similar as in the course.
Plaese help!

    "status": "error",
    "error": {
        "originalStack": "Error\n    at model.Query._wrappedThunk [as _findOne] (/media/rohit/SSD_D1/Project/natours-app/node_modules/mongoose/lib/helpers/query/wrapThunk.js:25:28)\n    at /media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:279:20\n    at _next (/media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:103:16)\n    at /media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:508:38\n    at processTicksAndRejections (node:internal/process/task_queues:78:11)",
        "statusCode": 500,
        "status": "error"
    "message": "Query was already executed: Review.findOne({ _id: new ObjectId(\"62b44ca73c5b3f0162267ea2...",
    "stack": "MongooseError: Query was already executed: Review.findOne({ _id: new ObjectId(\"62b44ca73c5b3f0162267ea2...\n    at model.Query._wrappedThunk [as _findOneAndUpdate] (/media/rohit/SSD_D1/Project/natours-app/node_modules/mongoose/lib/helpers/query/wrapThunk.js:21:19)\n    at /media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:279:20\n    at _next (/media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:103:16)\n    at /media/rohit/SSD_D1/Project/natours-app/node_modules/kareem/index.js:508:38\n    at processTicksAndRejections (node:internal/process/task_queues:78:11)"

not able to extract zip file downloaded

The Node Farm demo, as mentioned in the description is not working. It is showing an application error.


When a new user sign up and specified that the role is admin. It will create a new user but the role is still user instead of admin.


in node-farm projects emojis wrap on each other, (I,m using win 10. chrome Version 109.0.5414.120 (Official Build) (64-bit))
the solution is just to set the white-space property on .card__emoji (line 83), and .card__details (line 106) classes to nowrap.


Sometimes it's simpler to show in the snapshot than typing hundreds of words.
The problem occurred over the code line: let error = { ...err };
Basically, I don't know the reason but if I send to console I get undefined. The field doesn't exist after destructuring err.

One lesson before this one I had an issue with handleDuplicateFieldsDB function in which I had to use instead of using errmsg.match(RegEx...).


It seems like Express removed the name property inside the err object. Can anyone confirm this?
This is how it looks like on my Postman

    "status": "error",
    "error": {
        "stringValue": "\"5f9618b492f2d81f5cb032829\"",
        "kind": "ObjectId",
        "value": "5f9618b492f2d81f5cb032829",
        "path": "_id",
        "reason": {},
        "statusCode": 500,
        "status": "error"
    "message": "Cast to ObjectId failed for value \"5f9618b492f2d81f5cb032829\" at path \"_id\" for model \"Tour\"",
    "stack": "CastError: Cast to ObjectId failed for value \"5f9618b492f2d81f5cb032829\" at path \"_id\" for model \"Tour\"\n    at model.Query.exec (C:\\Users\\SayJee\\OneDrive\\Desktop\\Nodles\\complete-node-bootcamp-master\\4-natours\\practice\\node_modules\\mongoose\\lib\\query.js:4352:21)\n    at model.Query.Query.then (C:\\Users\\SayJee\\OneDrive\\Desktop\\Nodles\\complete-node-bootcamp-master\\4-natours\\practice\\node_modules\\mongoose\\lib\\query.js:4444:15)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)"

As you can see in the code above, there is no 'name' property,, therefore we can't use this code below anymore and it's outdated.
if( === 'CastError') error = handleCastErrorDB(error);
i even tried to make a console.log( and you know what? it returns undefined.

Is there an alternative solution for this? Thanks for checking out.

const features = new APIFeatures(Model.find(filter), req.query)

at this line:

    const features = new APIFeatures(Model.find(filter), req.query)

you use Model.find() and the first method that you use is the filter method of APIFeatures class.
If you look at line 16 of utils/apiFeatures.js file, you'll see that there's a line like:
this.query = this.query.find(JSON.parse(queryStr));
Here, you already have used the find method, and in the handlerFacotry file you try to set query as Model.find(). In this case, you are using find method, twice.
I think you should change the code to not use the filter method, twice in a row.

There is no need for this route in userController.js

exports.createUser = (req, res) => {
    status: 'error',
    message: 'This route is not yet defined! Please use /signup instead!',

Regular user will never reach this point, the route is restricted to admins only in userRoutes.js

The demo site at doesn't work properly due to the underlying API returning data in data nested results, e.g. returns

    "status": "success",
    "results": 10,
    "data": {
        "data": [
                "startLocation": {
                    "type": "Point",
                    "coordinates": [
                    "description": "Miami, USA",
                    "address": "301 Biscayne Blvd, Miami, FL 33132, USA"

I can't access or change the UV threadpool environment
i used this line of code : process.env.UV_THREADPOOL_SIZE
and i m using nodeJS version : v16.13.2

in The Problem with Callbacks: Callback Hell lesson

I just want to know the retriever string in dog.txt how it's working with

superagent.get(${data}/images/random).end((err, res) => {

when I play with retriever string by change some letters then it will not working !!
the retriever it's the results of data that's clear
but the retriever it self from where it's coming ?

The achive is corrupt.

In "forgotPassword" functionality when the link to resetPassword is being created and send to user's email
(const resetURL = ${req.protocol}://${req.get('host' )}/api/v1/users/resetPassword/${resetToken};)
the host header is being dynamically selected from the HTTP header and there is no check here. The attacker can simply change it to their own host and when the user receives the email and clicks on the link, the token will be sent to the attacker host, then they can change their victim's password.