TytoAlba's avatar

Issues with Sail after cloning project

Hi, Created a fresh laravel 10 projet and installed Livewire (3.0 beta) and Jetstream. Pushed to git. Trying to clone the same project onto another machine, which seemed to work but got two issues.

Using Windows WSL and project includes a PostGres Db with PostGIS. Got Sail projects working with similar on both machines, but can't clone projects either way without issues.

  1. Cloned project from Git
  2. Installed composer dependencies (code from https://laravel.com/docs/10.x/sail#installing-composer-dependencies-for-existing-projects)
  3. Created .env file (same db settings as original DB_CONNECTION=pgsql, DB_HOST=pgsql, DB_PORT=5432, DB_USERNAME=sail, DB_PASSWORD=password)
  4. Started sail (sail up -d)
  5. Installed NPM dependencies (sail npm install)
  6. Created new app key (sail artisan key:generate)
  7. Migrated database (sail artisan migrate) which completes
  8. Rebuilt livewire assets (sail npm run dev)

I've deleted docker containers several times, both volume and image. I've tried clearing all caches (sail artisan optimize:clear)

I can connect to PGSQL in terminal and can see the new database and tables generated correctly.

Issue 1 : Driver Error. connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "sail" In Docker Desktop, I can connect to the database and can see the dbase up and running and PostGres user and password as set correctly as in .env via docker (and dbase was successfully migrated)

Issue 2: Jetstream assets not loading correctly Initial Laravel splash screen appears fine. When I click on JetStream links to Log In or Register, I get huge JetStream svg image filling screen with input boxes not formatted below. Console includes 2 errors and warnings

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://0.0.0.0:5173/@vite/client. (Reason: CORS request did not succeed). Status code: (null).

Module source URI is not allowed in this document: “http://0.0.0.0:5173/@vite/client”. register:15:98

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://0.0.0.0:5173/resources/js/app.js. (Reason: CORS request did not succeed). Status code: (null).

Module source URI is not allowed in this document: “http://0.0.0.0:5173/resources/js/app.js”.

What step(s) am I missing or doing wrong to be able to use the project and connect to the db via TablePlus?

0 likes
1 reply
LaryAI's avatar
Level 58

Based on the information provided, it seems like you are encountering two issues: a driver error related to the PostgreSQL authentication and Jetstream assets not loading correctly. Here's a possible solution to address these problems:

  1. Driver Error: The error message suggests that the password authentication for the PostgreSQL user "sail" is failing. To resolve this issue, you can try the following steps:
  • Open your .env file and verify that the DB_PASSWORD value is set correctly. Make sure it matches the password you set for the PostgreSQL user.
  • Check if the PostgreSQL server is running and accessible. You can try connecting to it using a PostgreSQL client like TablePlus to ensure that the connection details are correct.
  • If you are using Docker, make sure that the PostgreSQL container is running and properly configured. You can check the logs of the container to see if there are any errors related to authentication.
  • If the issue persists, you can try resetting the PostgreSQL password for the "sail" user. You can do this by accessing the PostgreSQL container and running the necessary commands to update the password.
  1. Jetstream Assets Not Loading Correctly: The error messages suggest that there might be a cross-origin request issue when loading the Jetstream assets. To resolve this issue, you can try the following steps:
  • Open your .env file and make sure that the APP_URL value is set correctly. It should match the URL you are using to access your application.
  • Check if there are any CORS-related configurations in your Laravel application. You can review the config/cors.php file and ensure that it allows requests from the correct origins.
  • If you are using a reverse proxy or load balancer, make sure it is properly configured to handle CORS headers.
  • Clear any cached assets by running the following command: sail artisan optimize:clear.
  • If the issue persists, you can try running the application without Sail (using the built-in PHP server or a different local development environment) to see if the issue is specific to Sail.

Please note that these are general troubleshooting steps, and the exact solution may vary depending on your specific setup and configuration. If the issues persist, it might be helpful to provide more details about your environment and any relevant error logs for further assistance.

Please or to participate in this conversation.