basir / amazona Goto Github PK
View Code? Open in Web Editor NEWBuild Ecommerce Like Amazon By MERN Stack
Home Page: https://www.udemy.com/course/build-ecommerce-website-like-amazon-react-node-mongodb
Build Ecommerce Like Amazon By MERN Stack
Home Page: https://www.udemy.com/course/build-ecommerce-website-like-amazon-react-node-mongodb
Please Help ProductScreen is not working
Thank you.
At line 23 of Product.js in components folder, You have this error "{product.seller.seller.name}". seller is being called twice.
MY DATABASE IS SHOWING ERROR, PRODUCTS AND CATEGORIES ARE NOT SHOWING
Error: Invariant failed: A state mutation was detected between dispatches, in the path 'cart.itemsPrice'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)
updating the cart from placeorderscreen causes this error when you try to sign out
Knowing id of User it could be possible to access to other information
Hey there!
I belong to an open source security research community, and a member (@ktg9) has found an issue, but doesn’t know the best way to disclose it.
If not a hassle, might you kindly add a SECURITY.md
file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.
Thank you for your consideration, and I look forward to hearing from you!
(cc @huntr-helper)
I was expecting that in backend (or at least in frontend) there would be a check if the order is belonging to user (or seller or admin).
It seems that anyone could access to orders of another user (thus also some additional data such as shipping address).
How to fix this issue? can you teach me how to fix this issue?
i am facing this issue in cartScreen.js-
Uncaught TypeError: cartItems.map is not a function
can anyone help?
TypeError: Cannot read property 'map' of undefined
getting this error while working on "Create React App" assignment. The error is coming from App.js
16 |
17 |
19 |
| ^ 20 | {data.products.map((product) => (
21 |
22 | <a href={/product/${product._id}
}>
By copying unavailable item id to cart with qty link for example https://amazona.webacademy.pro/cart/5f7ae598281b5e7551d188bb?qty=1
It will add and let you proceed to the payment screen.
Products are not showing on Home Screen after connecting to MongoDB (edits to server.js) and deleting ID from products in backend data.js
Hllo please help me when I deploy it to heroku and when I will connect with MongoDB atlas it will not insert my sample users and product into online MongoDB atlas database so i will copy paste products data manually it will show product but when I click on product It will show error product not found can you help me to solve this.
And when I register as newbuddy it insert data in online database and also signin works with that .
The Continue button on Payment Method Screen (PayPal/Stripe) is not working or redirecting to Place Order Screen.
2022-07-01T18:57:21.194308+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
2022-07-01T18:58:14.106281+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=db-store-app.herokuapp.com request_id=af63302d-a50a-411f-af8e-6ec1cf7adcf0 fwd="41.81.150.65" dyno= connect= service= status=503 bytes= protocol=https
2022-07-01T18:58:20.170740+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-07-01T18:58:20.197793+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-07-01T18:58:20.356448+00:00 heroku[web.1]: Process exited with status 137
2022-07-01T18:58:20.525483+00:00 heroku[web.1]: State changed from starting to crashed
2022-07-01T18:58:21.554536+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=db-store-app.herokuapp.com request_id=78723726-98c3-4423-8be4-41b3638ae7ac fwd="41.81.150.65" dyno= connect= service= status=503 bytes= protocol=https
Kindly resolve this issue .
Why this issue occure it try many time but i don't get the correct path . This issue occure when i open
Orders
Ordershistory
The above error occure
![IMG-20220602-WA0044](https://user-
images.githubusercontent.com/107805608/174526077-9905e146-dd98-413b-89dc-a647196bc4f9.jpg)
i have fallow the tutorial up to video no 45 - full course.
i getting this error when deploying to heroku.
/app/back-end/server.js:1
import express from 'express'
^^^^^^^
app[web.1]:
app[web.1]: SyntaxError: Unexpected identifier.
at video 45 the website is pushing to heroku as is..
and in my case i had to convert only the server side to es2015 to see it working on heroku.
this is my root package.json
`{
"name": "amazona-shop-ml-1",
"version": "1.0.0",
"description": "eCom react and node look like amazon",
"main": "index.js",
"engines": {
"node": "12.4.0",
"npm": "6.9.0"
},
"scripts": {
"build": "cd front-end && npm install && npm run build",
"start": "nodemon --watch back-end --exec node --experimental-modules back-end/server.js"
},
"scriptsxxxxx": {
"heroku-postbuild": "npm run build && cd front-end && npm install && npm run build",
"build": "cd front-end && npm install && npm run build",
"start": "nodemon --watch back-end --exec babel-node back-end/server.js",
"server": "nodemon --watch back-end --exec babel-node back-end/server.js",
"client": "cd front-end && npm run start",
"dev": "npm run server & (npm run client)",
"dev1": "concurrently "npm run server" "npm run client""
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"concurrently": "^5.3.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.10.15",
"multer": "^1.4.2"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/node": "^7.12.6",
"@babel/preset-env": "^7.12.1",
"eslint": "^7.15.0",
"eslint-plugin-react": "^7.21.5",
"nodemon": "^2.0.6"
}
}
`
i would like to use the save ES version as in the course and not an old version of java script.
regards.
PS D:\projects\e-Commerce Website\Grab & Go\frontend> npm start
[email protected] start
react-scripts start
'Go\frontend\node_modules.bin' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:965
throw err;
^
Error: Cannot find module 'D:\projects\e-Commerce Website\react-scripts\bin\react-scripts.js'
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
After update everything, ProductEditScreen isnt working only shows empty screen
ValidationError:: orderItems.0.product: Path product
is required.
at model.Document.invalidate (C:\Users\madhu\Desktop\Student Projects\Latest\mongodb\node_modules\mongoose\lib\document.js:2760:32)
at EmbeddedDocument.invalidate (C:\Users\madhu\Desktop\Student Projects\Latest\mongodb\node_modules\mongoose\lib\types\embedded.js:298:29)
at C:\Users\madhu\Desktop\Student Projects\Latest\mongodb\node_modules\mongoose\lib\document.js:2552:17
at C:\Users\madhu\Desktop\Student Projects\Latest\mongodb\node_modules\mongoose\lib\schematype.js:1273:9
at processTicksAndRejections (internal/process/task_queues.js:75:11)
If you are stuck in this part maybe you need to delete mongodb database and recreate it, that solved my problem.
Originally posted by @jorgeariasacevedo in #52 (comment)
Good Afternoon Basir,
Thank you for the tutorial. When I move .gitignore from src to root, I get the terminal error: "nothing added to commit but untracked files present."
Hi. There's a problem with error handling. Whenever you enter a wrong product id in the browser bar, the response must be 404 Product Not Found. But, if you enter manually an ID that is not in MongoDB format (for example, if you make it shorter) the backhand throws an error in 'find' function which is shown on the front end. How can we check for correct formatting? Preferably before the request goes, so that we could redirect the user immediately.
The state of cart (if there were items in it) is not set to empty when user signs out.
export const signout = () => (dispatch) => {
localStorage.removeItem('userInfo');
localStorage.removeItem('cartItems');
dispatch({ type: USER_SIGNOUT });
};
import React, { useEffect, } from 'react';
import Product from '../components/Product';
import LoadingBox from '../components/LoadingBox';
import MessageBox from '../components/MessageBox';
import { useDispatch, useSelector } from 'react-redux';
import { listProducts } from '../actions/productAction';
export default function HomeScreen() {
const dispatch = useDispatch();
const productList = useSelector((state) => state.productList);
const { loading, error, products } = productList;
useEffect(() => {
dispatch(listProducts());
}, [dispatch]);
return (
I'm getting a : TypeError: Cannot read property 'category' of undefined
Originally posted by @luxi101 in #56 (comment)
everything has been going well as am building shopping cart, but when i click in product it says request failed with status code 404.
here is my server.js
`import express from 'express';
import data from './data.js';
const app = express();
app.get('/api/Products/:id', (req, res) => {
const product = data.products.find((x) => x._id === req.params.id);
if (product) {
res.send(product);
} else {
res.status(404).send({ message: 'Product Not Found' });
}
});
app.get('/api/products', (req, res) => {
res.send(data.products);
});
app.get('/', (req, res) => {
res.send('Server is ready');
});
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(Serve at http://localhost: ${port}
);
});`
Kindly resolve this issue .
Why this issue occure it try many time but i don't get the correct path . This issue occure when i open
Orders
Ordershistory
The above error occure
![IMG-20220602-WA0044](https://user-
images.githubusercontent.com/107805608/174526077-9905e146-dd98-413b-89dc-a647196bc4f9.jpg)
I followed EXACT STEPS from lesson1 until 28, when I clicked place order button , it returned INVALID TOKEN. INSPECT shows " Failed to load resource: the server responded with a status of 401 (Unauthorized) "...
Can anyone help
?
Hello Basir, thank you for providing this as a reference and making this code available. I went through some of the tutorials on YouTube and thought I would try to fork and start fresh from your repo. I was having an issue with running the seed URL on localhost.
from: " 5. Seed Users and Products
Run this on chrome: http://localhost:5000/api/users
It returns admin email and password ";
{
"message": "ENOENT: no such file or directory, stat '/Users/johnsasser/Desktop/SandBox/amazona/frontend/build/index.html'"
}
is the return message from the req.
I got 500 internal server err on the GET req.
I received the same results from both seeding instructions. Is there something simple I am missing?
facing these issues at the homeScreen.js
`import React, { useEffect, useState } from 'react';
import axios from 'axios';
import Product from '../components/Product';
import LoadingBox from '../components/LoadingBox';
import MessageBox from '../components/MessageBox';
export default function HomeScreen() {
const [products, setProducts] = useState([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(false);
useEffect(() => {
const fecthData = async () => {
try {
setLoading(true);
const { data } = await axios.get('/api/products');
setLoading(false);
setProducts(data);
} catch (err) {
setError(err.message);
setLoading(false);
}
};
fecthData();
}, []);
return (
Hi,
I keep getting "SyntaxError: Unexpected identifier" when trying to run node in the beginning of lesson 9.
I also added "type": "module" in the package.json. Nothing works.
Here is my code in server.js:
`import express from 'express';
import data from './data.js';
const app = express();
app.get('/api/products', (req, res) => {
res.send(data.products);
});
app.get('/', (req, res) => {
res.send('Server is ready');
});
app.listen(5000, () => {
console.log('Serve at http://localhost:5000');
});`
Hi,
do you have any solution for flickering UI while loading?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.