Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloned, installed, built or started the app, but login fails. #1

Open
fredaranha opened this issue Dec 27, 2023 · 9 comments
Open

Cloned, installed, built or started the app, but login fails. #1

fredaranha opened this issue Dec 27, 2023 · 9 comments

Comments

@fredaranha
Copy link

After successfully cloning the repository, installing dependencies with npm install, and building or running the application with npm run build or npm start, you may encounter an issue when attempting to log in. The error message "No Server Response" indicates that the application is not receiving the expected response from the server during the login process.

@pafavero
Copy link
Owner

Hi, you obtain the following error?

image

And if you open your browser console, you can see the following error?
image

If this is your case, this means that your local version is trying to connect to the server
http://localhost:3005 which is not configured/installed on your machine.

As a temporary solution to allow you to test the application, you can use my server https://nextjs-rho-six-97.vercel.app/. Simply copy the contents of .env.production to .env.development. And run the "npm start" command again. It should work!

@ThomasCarstens
Copy link

Hi @pafavero , Can you give instructions on setting up a database once the Supabase project is running. Do you have a single table of bookings? I would like to run my own instance.

@ThomasCarstens
Copy link

ThomasCarstens commented Jan 2, 2024

https://supabase.com/docs/guides/getting-started/quickstarts/nextjs Seems Like a good start. I think I still would need the database structure from Supabase. Thanks for any advice.

Hi @ThomasCarstens,
here you can find sql to generate the tables that you need:
https://github.com/pafavero/nextjs_book_a_seat/blob/main/sql/create_db.sql

Running a database in Supabase should not be particularly difficult. I can't recall any particular difficulties in using it now, but it was a year ago when I set up the db. I chose Supabase because I was looking for a free online database for non-commercial projects...

@fredaranha
Copy link
Author

Hi, you obtain the following error?

image

And if you open your browser console, you can see the following error? image

If this is your case, this means that your local version is trying to connect to the server http://localhost:3005 which is not configured/installed on your machine.

As a temporary solution to allow you to test the application, you can use my server https://nextjs-rho-six-97.vercel.app/. Simply copy the contents of .env.production to .env.development. And run the "npm start" command again. It should work!

Hello, I've encountered the exact error you described, but I'm having trouble understanding the solution.

I followed the installation instructions, so why is the server not configured or installed on my machine?

To resolve the issue, do I just need to copy the contents from https://nextjs-rho-six-97.vercel.app/.env.production to my .env.development file?

@pafavero
Copy link
Owner

pafavero commented Jan 3, 2024

Hi @fredaranha, the solution that I propouse was a temporary solution to substitute my local server http://localhost:3005/ with my public server on https://nextjs-rho-six-97.vercel.app/

I forgot to include some useful information in the readme file about how the application works and I think it was not so clear to understand. I am sorry about that. This is an experimental prototype project that I made in my spare time about a year ago, so it is far from perfect! Feel free to use it, but it has never been a real productive project!

The Repo https://github.com/pafavero/book_a_seat contains all codes for the frontend and it is a pure React application (generated with create-react-app https://github.com/facebook/create-react-app ).

In addition, I use nextjs as a framework to retrieve data from the db, because nextjs supports API routes (it provides a solution to build a public API). For example if the React App needs to know all reservation related to seat 1, it will makes the following API request: http://YOR_NEXTJS_URL/api/reservations?selSeat=1

I push today the nextjs project on my repo (https://github.com/pafavero/nextjs_book_a_seat ), it can be useful to see how it works.

The dabase contains only 3 tables and the sql to generate them can be found here:
https://github.com/pafavero/nextjs_book_a_seat/blob/main/sql/create_db.sql

@fredaranha
Copy link
Author

Hello @pafavero ,

I attempted to deploy the application using the repositories https://github.com/pafavero/nextjs_book_a_seat and executed the scripts from https://github.com/pafavero/nextjs_book_a_seat/blob/main/sql/create_db.sql (note: the script is missing the step to create the schema). Subsequently, I deployed https://github.com/pafavero/book_a_seat. However, the initial error I mentioned still persists.

During API testing with endpoints like "hello db" and "api/hello," everything appeared to be functioning correctly. However, when attempting to log in with the user1 account, an error was encountered. Do you have any insights or suggestions to address this issue?

@fredaranha
Copy link
Author

the main problem is here now
err

@pafavero
Copy link
Owner

You said that the endpoints like "hello db" and "api/hello works. Where do you deploy the API? I mean, when I work locally I deploy on my local server (http://localhost:3005/), So I can successfully call the following URLs:
http://localhost:3005/api/hello
http://localhost:3005/api/helloDb
http://localhost:3005/api/seats
http://localhost:3005/api/reservations?selSeat=1

I tried to reproduce your error, I suppose you have a problem with CORS, because the App works with 2 different domains.
The main issue is not "errRef.current.focus", but the error that appears before.

Do you have something like that:

Bildschirmfoto zu 2024-01-11 22-52-53

Bildschirmfoto zu 2024-01-11 22-53-38

Do you have an error similar to this one in your browser console "Referrer Policy: strict-origin-when-cross-origin"?

@fredaranha
Copy link
Author

Hi @pafavero

Yes, I have successfully deployed the API on my local environment using the address http://127.0.0.1:3005/, which prevented the occurrence of CORS errors.

The specific error I encountered was: "uncaught (in Promise) .... focus," as illustrated in the following image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants