« first day    last day (51 days later) » 

1:15 AM
Hello, Hamada. Thank you for creating the room. Sorry for the late response. The console.log for req and res is not showing up in the console. I can create a CodeSandbox of the application and send it to you for better understanding. Please give me a second.
 
 
2 hours later…
3:45 AM
Hello Hamada. I was only able to import the client side of my application to Codesandbox. However, I manually pasted the server related logic in the 'functions' folder.
Right-click and inspect to see the console. After logging in/signing up, click on Expand Post and comment on a post. You’ll find that it triggers a 500 Internal Server Error, amongst other things.
Related Logic
functions/index: line 33
functions/handlers/post: line 84 commentOnPost
src/components/CommentForm: line 34 handleSubmit
src/features/data/dataSlice: line 66 submitComment
src/features/data/dataSlice: line 120 submitTheComment
Thank you for your help
 
 
6 hours later…
10:16 AM
do you have access to the other end-points like getPosts or createPost or getPost ...?
If yes, let debug your submitComment how to make the req to the end-point
return axios
.post(`/post/${postId}/comment`, commentData)
just here pass some consoles to see if your get the postId and the commentData
 
if yes you are getting all data pass another one in .then(res => { console.log(res)
and in the .catch(err => { console.log("catch submit", err) dispatch(setErrors(err.response.data))})
 
try pass string and the variable to the console like console.log("This res is from Post ", res) to make it eazy
 
 
7 hours later…
5:49 PM
Hello, Hamada. I've followed your instructions and here is what I've received.
It seems like this code is throwing the 500 Internal Server Error. .post(/post/${postId}/comment, commentData)
 
Great
so the problem look like to the end-pont ... I see you are runing your app in server HerokuApp
can you make a req to this end-pont but pass just here exports.commentOnPost = (req, res) => { console.log("Req to CommentOnPost", req);
Can you run your server local like localhost:3000
because can be for server things like removing .env file from my gitignore.
Heroku deploy by git repositorry
You can run this command to see what happens in the server
heroku logs -t
 
6:29 PM
I'm actually using Heroku as my proxy server, but the application is hosted on Firebase.
I've added the console.log inside commentOnPost like so
Unfortunately, I''m not able to see the console.log("REQUEST ON COMMENTONPOST", req) inside the console.
 
if you have all code run it in your computer
 
Sorry, what do you mean? I'm running the application currently on local.
 
can you make a req to another end point like app.get("/post/:postId/like", firebaseAuth, likePost);
and ther pass console.log("Req to likePost", req)
@ln09nv2 you are making requiest to your server (https://...) you can see the url
in local look like localhost:3000/post
 
I see what you're saying. Ok, one second.
I've added a console to likePost like so
likePost works as expected but I do not see the console statement
May I ask how to not make a request to the server?
I'm currently running on localhost:3000
 
7:16 PM
the console.log in the front side you see this in browser console
but the backend or server you see this in the terminal
you can see here
the server is running in localhos:3000 and the app in localhost:4200
I hope you are not running server and front in the same is very insecure
 
7:43 PM
Thank you for explaining. Sorry, I'm not aware of that.
I have 3 package.json files as seen here
I'd like to add some background of what I've done. The application as a whole was running as expected. I decided to refactor the application to use Redux Toolkit. After the refactor, I received a CORS error. I then added my own Heroku proxy server 'https://shielded-journey-88539.herokuapp.com/', so now axios.defaults.baseURL =
'https://shielded-journey-88539.herokuapp.com/https://us-central1-groupgrid-1d191.cloudfunctions.net/api'
I also added the Heroku proxy server to client/package.json like so "proxy": "https://shielded-journey-88539.herokuapp.com/us-central1-groupgrid-1d191.cloudfunctions.net/api";
I then no longer receive the CORS error but now receive the 500 Internal Server Error.
 
8:12 PM
I've removed the Heroku proxy server code from client/package.json
Also removed the Heroku proxy server from the baseUrl inside App
Sorry the above is the wrong screenshot. Here is the correct screenshot for removing the Heroku proxy server from the baseUrl inside of App
Unfortunately, I still receive the 500 error.
 
 
2 hours later…
9:59 PM
now you can run your app local, open a terminal (maybe from your ide is posible) navigate to the folder of .json file and run the script: start
and there will see what happen to your request to the server
I must be honest is the first time I see this architecture
Normally there are two different parts let say Backend and Frontend
 
10:17 PM
Ok, I star looking how it work this arch
 
From the top level package.json, running 'npm start' gives me this error.
 
And basicly you deploy some function to firebase to work as a server
Sorry
Will not work
 
Sorry, disregard my most previous message.
 
no worry
Do you have postman?
 
This is the backend code of the tutorial I've followed. github.com/hidjou/classsed-react-firebase-functions
 
10:20 PM
copy the URL you get the error
 
Yes, I have Postman. I'll go ahead and screenshot what goes on when I make the request on Postman.
 
great
 
I'm receiving a Invalid Host Header
Sure, this is the url from the commentOnPost route on Postman 'http://localhost:3000/groupgrid-1d191/us-central1/api/post/3Y7OcHJXXXa0ilBeq35u/comment'
 
I'm sorry About telling you to run in LocalHost
this can not work like this
 
No worries, what would you like me to do instead?
 
10:32 PM
:52444108
this URL is the good one I think because the server-side is run in firebase
 
Ok, I see what you mean.
 
app.get("/posts", getPosts); Can you get some Id's form this end-point
 
When I run this url 'https://us-central1-groupgrid-1d191.cloudfunctions.net/api/post/3Y7OcHJXXXa0ilBeq35u/comment' on Postman, I receive this
Ok, I will get some id's from this endpoint 'app.get("/posts", getPosts)'
 
you can see
let do samething to fix this!
ok
we will remove some lettel code and deploy only the funcition
ok?
 
Ok sure I'll follow your instructions
 
10:42 PM
here in your app.post("/post/:postId/comment", firebaseAuth, commentOnPost);
remove this meddelware firebaseAuth
app.post("/post/:postId/comment", commentOnPost);
before plase make sore you do back to your stable code
Once you have everything like before and you save in function folder the letter code of firebaseAuth removed
in folder project in run this code to deploy only the functions
 
Ok I've removed the firebaseAuth middleware
 
firebase deploy --only functions
 
👍
 
Where do I run 'firebase deploy --only functions' from? Is it my current level or client folder or functions folder?
I'll try and run 'firebase deploy --only functions' inside the top level, where client and functions are children
 
10:54 PM
just there, will be thorow an error if is not correct place
 
Ok, I receive an HTTP error
 
you are not login in your firebase accont
 
Ahh sorry about that, one second
Actually, when I type firebase login, it says I'm already logged in
I will logout and log in again
 
app.get("/posts", getPosts);
app.post("/post", firebaseAuth, createPost);
app.get("/post/:postId", getPost);
app.post("/post/:postId/comment", commentOnPost);<-------- remove auth only here
app.get("/post/:postId/like", firebaseAuth, likePost);
app.get("/post/:postId/unlike", firebaseAuth, unlikePost);
app.delete("/post/:postId", firebaseAuth, deletePost);
don't worry
firebase login
run this code
I need go SLEEP
 
Ok, I removed ONLY the firebaseAuth from the commentOnPost route, then ran 'firebase deploy --only functions"
 
11:05 PM
yes
 
Some functions were not able to deploy, but the commentOnPost route was able to, I believe
 
7
Q: Google Cloud Storage bucket throws error "The project to be billed is associated with a closed billing account."

JacksonI already checked my project and it has an active billing account I am using node js var gcloud = require('gcloud'); var gcs = gcloud.storage({ projectId: config.gcloud.projectid, keyFilename: config.gcloud.keyfilename }); var bucket = gcs.bucket(bucketName); bucket.upload(filePath, ...

look like you pass your limit for free
I still get "error": "Unauthorized"
try search about that
I go Sleep, see u and good luky🙂
 
Thank you so much, Hamada!
I'll go ahead and continue looking to resolve this.
I appreciate all your help!
 
u welcome!
 

« first day    last day (51 days later) »