Git Product home page Git Product logo

taxi-react-app-part-3's People

Contributors

parentja avatar

Watchers

James Cloos avatar  avatar

Forkers

daaww

taxi-react-app-part-3's Issues

when build docker got : if you are behind a proxy, please make sure that the 'proxy' config is set properly

Current Behavior

I want to build a docker-compose for a taxi-app project I'm working on.
and just to be clear I can install any package normally with npm i [any package]
when i run docker-compose up -d --build

Building 52.9s (22/23)
 => [taxi-app_taxi-server internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 359B                                                                                   0.0s 
 => [taxi-app_taxi-server internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 86B                                                                                       0.0s 
 => [taxi-app_taxi-client internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 468B                                                                                   0.0s 
 => [taxi-app_taxi-client internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 119B                                                                                      0.0s 
 => [taxi-app_taxi-server internal] load metadata for docker.io/library/python:3.7.5-alpine                            2.5s 
 => [taxi-app_taxi-client internal] load metadata for docker.io/library/node:16.13.1-alpine                            2.4s 
 => [taxi-app_taxi-client 1/7] FROM docker.io/library/node:16.13.1-alpine@sha256:0e071f3c5c84cffa6b1035023e1956cf28d4  0.0s 
 => [taxi-app_taxi-client internal] load build context                                                                 0.0s 
 => => transferring context: 1.20kB                                                                                    0.0s 
 => [taxi-app_taxi-server internal] load build context                                                                 0.0s 
 => => transferring context: 6.31kB                                                                                    0.0s 
 => [taxi-app_taxi-server 1/7] FROM docker.io/library/python:3.7.5-alpine@sha256:de9fc5bc46cb1a7e2222b976394ea8aa0290  0.0s 
 => CACHED [taxi-app_taxi-client 2/7] RUN mkdir -p /usr/src/app                                                        0.0s 
 => CACHED [taxi-app_taxi-client 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-client 4/7] COPY package.json /usr/src/app/package.json                                      0.0s 
 => CACHED [taxi-app_taxi-client 5/7] COPY package-lock.json /usr/src/app/package-lock.json                            0.0s 
 => ERROR [taxi-app_taxi-client 6/7] RUN npm install --production                                                     50.2s 
 => CACHED [taxi-app_taxi-server 2/7] RUN apk update && apk add build-base python-dev py-pip jpeg-dev zlib-dev openss  0.0s 
 => CACHED [taxi-app_taxi-server 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-server 4/7] COPY ./requirements.txt /usr/src/app                                             0.0s 
 => CACHED [taxi-app_taxi-server 5/7] RUN pip install --upgrade pip                                                    0.0s 
 => CACHED [taxi-app_taxi-server 6/7] RUN pip install -r requirements.txt                                              0.0s 
 => CACHED [taxi-app_taxi-server 7/7] COPY . /usr/src/app                                                              0.0s 
 => [taxi-app_taxi-server] exporting to image                                                                          0.0s 
 => => exporting layers                                                                                                0.0s 
 => => writing image sha256:8e2a1a48d84a0735199a7e2b0cfe562cbcfa5392b595f63023b023ad311cda23                           0.0s 
 => => naming to docker.io/library/taxi-app_taxi-server                                                                0.0s 
------
 > [taxi-app_taxi-client 6/7] RUN npm install --production:
#13 50.06 npm notice
#13 50.06 npm notice New minor version of npm available! 8.1.2 -> 8.3.0
#13 50.06 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
#13 50.06 npm notice Run `npm install -g [email protected]` to update!
#13 50.06 npm notice
#13 50.06 npm ERR! code ERR_SOCKET_TIMEOUT
#13 50.07 npm ERR! network Socket timeout
#13 50.07 npm ERR! network This is a problem related to network connectivity.
#13 50.07 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#13 50.07 npm ERR! network
#13 50.07 npm ERR! network If you are behind a proxy, please make sure that the
#13 50.07 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
#13 50.10
#13 50.10 npm ERR! A complete log of this run can be found in:
#13 50.10 npm ERR!     /root/.npm/_logs/2022-01-07T14_03_29_522Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install --production]: exit code: 
1

Expected Behavior

built the docker container without any problem,

Steps To Reproduce

  1. clone this repro https://github.com/shakori999/taxi-app.git
  2. Run docker-compose up -d --build
  3. See error...
Building 52.9s (22/23)
 => [taxi-app_taxi-server internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 359B                                                                                   0.0s 
 => [taxi-app_taxi-server internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 86B                                                                                       0.0s 
 => [taxi-app_taxi-client internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 468B                                                                                   0.0s 
 => [taxi-app_taxi-client internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 119B                                                                                      0.0s 
 => [taxi-app_taxi-server internal] load metadata for docker.io/library/python:3.7.5-alpine                            2.5s 
 => [taxi-app_taxi-client internal] load metadata for docker.io/library/node:16.13.1-alpine                            2.4s 
 => [taxi-app_taxi-client 1/7] FROM docker.io/library/node:16.13.1-alpine@sha256:0e071f3c5c84cffa6b1035023e1956cf28d4  0.0s 
 => [taxi-app_taxi-client internal] load build context                                                                 0.0s 
 => => transferring context: 1.20kB                                                                                    0.0s 
 => [taxi-app_taxi-server internal] load build context                                                                 0.0s 
 => => transferring context: 6.31kB                                                                                    0.0s 
 => [taxi-app_taxi-server 1/7] FROM docker.io/library/python:3.7.5-alpine@sha256:de9fc5bc46cb1a7e2222b976394ea8aa0290  0.0s 
 => CACHED [taxi-app_taxi-client 2/7] RUN mkdir -p /usr/src/app                                                        0.0s 
 => CACHED [taxi-app_taxi-client 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-client 4/7] COPY package.json /usr/src/app/package.json                                      0.0s 
 => CACHED [taxi-app_taxi-client 5/7] COPY package-lock.json /usr/src/app/package-lock.json                            0.0s 
 => ERROR [taxi-app_taxi-client 6/7] RUN npm install --production                                                     50.2s 
 => CACHED [taxi-app_taxi-server 2/7] RUN apk update && apk add build-base python-dev py-pip jpeg-dev zlib-dev openss  0.0s 
 => CACHED [taxi-app_taxi-server 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-server 4/7] COPY ./requirements.txt /usr/src/app                                             0.0s 
 => CACHED [taxi-app_taxi-server 5/7] RUN pip install --upgrade pip                                                    0.0s 
 => CACHED [taxi-app_taxi-server 6/7] RUN pip install -r requirements.txt                                              0.0s 
 => CACHED [taxi-app_taxi-server 7/7] COPY . /usr/src/app                                                              0.0s 
 => [taxi-app_taxi-server] exporting to image                                                                          0.0s 
 => => exporting layers                                                                                                0.0s 
 => => writing image sha256:8e2a1a48d84a0735199a7e2b0cfe562cbcfa5392b595f63023b023ad311cda23                           0.0s 
 => => naming to docker.io/library/taxi-app_taxi-server                                                                0.0s 
------
 > [taxi-app_taxi-client 6/7] RUN npm install --production:
#13 50.06 npm notice
#13 50.06 npm notice New minor version of npm available! 8.1.2 -> 8.3.0
#13 50.06 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
#13 50.06 npm notice Run `npm install -g [email protected]` to update!
#13 50.06 npm notice
#13 50.06 npm ERR! code ERR_SOCKET_TIMEOUT
#13 50.07 npm ERR! network Socket timeout
#13 50.07 npm ERR! network This is a problem related to network connectivity.
#13 50.07 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#13 50.07 npm ERR! network
#13 50.07 npm ERR! network If you are behind a proxy, please make sure that the
#13 50.07 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
#13 50.10
#13 50.10 npm ERR! A complete log of this run can be found in:
#13 50.10 npm ERR!     /root/.npm/_logs/2022-01-07T14_03_29_522Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install --production]: exit code: 
1

Environment

  • npm:8.3.0
  • Node.js:v16.13.1
  • OS Name: windows 10 x64
  • System Model Name:
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\shako\\AppData\\Roaming\\npm"

; "user" config from C:\Users\shako\.npmrc

http = "http://localhost:3128"
registry = "https://registry.npmjs.org/"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\shako\Desktop\taxi-app\client
; HOME = C:\Users\shako
; Run `npm config ls -l` to show all defaults.

loading trips fails

Current Behavior

I'm at part 3 chapter 5
tried to load the trips on the rider/driver dashboard but it failed with this error on cypress, and this is the same error in both rider/driver
if there is an info you need to know more or not mentioned here , I'll share it as fast as possible

Timed out retrying after 4000ms: Expected to find content: 'STARTED' within the element: <div.mb-3.card> but never did.

Steps To Reproduce

  1. clone this repro https://github.com/shakori999/taxi-app.git
  2. Run docker-compose up -d --build
  3. Run `git checkout 31f4d72
  4. inside client folder Run npx cypress open
  5. Run driver.spec.js test

driver.spec.js

const logIn = () => {
  const { username, password } = Cypress.env('driver');
  cy.server();
  cy.route('POST', '**/api/log_in/').as('logIn');
  cy.visit('/#/log-in');
  cy.get('input#username').type(username);
  cy.get('input#password').type(password, { log: false });
  cy.get('button').contains('Log in').click();
  cy.wait('@logIn');
};

describe('The driver dashboard', function () {
    before(function () {
        cy.loadUserData();
    });
  it('Cannot be visited if the user is not a driver', function () {
    const { username, password } = Cypress.env('rider')

    // Capture API calls.
    cy.server()
    cy.route('POST', '**/api/log_in/').as('logIn')

    // Log in.
    cy.visit('/#/log-in')
    cy.get('input#username').type(username)
    cy.get('input#password').type(password, { log: false })
    cy.get('button').contains('Log in').click()
    cy.hash().should('eq', '#/')
    cy.get('button').contains('Log out')
    cy.wait('@logIn')

    cy.visit('/#/driver')
    cy.hash().should('eq', '#/')
  }),
  it('Can be visited if the user is a driver', function () {
    logIn();

    cy.visit('/#/driver')
    cy.hash().should('eq', '#/driver')
    })

  context('When there are no trips', function () {
    before(function () {
      cy.task('tableTruncate', {
        table: 'trips_trip'
      });
    });

    it('Displays messages for no trips', function () {
      cy.server();
      cy.route('GET', '**/api/trip/').as('getTrips');

      logIn();

      cy.visit('/#/driver');
      cy.wait('@getTrips');

      // Current trips.
      cy.get('[data-cy=trip-card]')
        .eq(0)
        .contains('No trips.');

      // Requested trips.
      cy.get('[data-cy=trip-card]')
        .eq(1)
        .contains('No trips.');

      // Completed trips.
      cy.get('[data-cy=trip-card]')
        .eq(2)
        .contains('No trips.');
    });
  });
  context('When there are trips', function () {
    before(function () {
      cy.loadTripData();
    });

    it('Displays current, requested, and completed trips', function () {
      cy.server();
      cy.route('GET', '**/api/trip/').as('getTrips');

      logIn();

      cy.visit('/#/driver');
      cy.wait('@getTrips');

      // Current trips.
      cy.get('[data-cy=trip-card]')
        .eq(0)
        .contains('STARTED');

      // Requested trips.
      cy.get('[data-cy=trip-card]')
        .eq(1)
        .contains('REQUESTED');

      // Completed trips.
      cy.get('[data-cy=trip-card]')
        .eq(2)
        .contains('COMPLETED');
    });
  });
})

trips.json

[
  {
    "id": "f0a132af-97d1-4b50-ba2a-0bff0b4a32ed",
    "created": "2019-06-01 00:00:00",
    "updated": "2019-06-01 00:00:00",
    "pick_up_address": "6969 Fifth St",
    "drop_off_address": "2846 Central St",
    "status": "COMPLETED",
    "rider_id": 2,
    "driver_id": 1
  },
  {
    "id": "676cb20b-d51d-44b5-951a-3e3c72a42668",
    "created": "2019-06-02 00:00:00",
    "updated": "2019-06-02 00:00:00",
    "pick_up_address": "231 Oak Ridge Ln",
    "drop_off_address": "8746 Spring Hill Rd",
    "status": "STARTED",
    "rider_id": 2,
    "driver_id": 1
  },
  {
    "id": "987a8e30-ca2f-4019-bbd9-1c7441e2ab1d",
    "created": "2019-06-03 00:00:00",
    "updated": "2019-06-03 00:00:00",
    "pick_up_address": "8061 College St",
    "drop_off_address": "2782 E Pecan St",
    "status": "REQUESTED",
    "rider_id": 2,
    "driver_id": 1
  }
]

index.js

import 'cypress-file-upload';

const loadUserData = () => {
  cy.fixture('data/users.json').then((users) => {
    cy.task('tableInsert', {
      table: 'trips_user', rows: users, truncate: true
    })
  });
  cy.fixture('data/groups.json').then((groups) => {
    cy.task('tableInsert', {
      table: 'auth_group', rows: groups, truncate: true
    })
  });
  cy.fixture('data/user_groups.json').then((groups) => {
    cy.task('tableInsert', {
      table: 'trips_user_groups', rows: groups, truncate: true
    })
  });
}

// new
Cypress.Commands.add('loadUserData', loadUserData);

const loadTripData = () => {
  cy.fixture('data/trips.json').then((trips) => {
    cy.task('tableInsert', {
      table: 'trips_trip', rows: trips, truncate: true
    });
  });
};

Cypress.Commands.add('loadTripData', loadTripData);

components/Driver.js

import React, {useEffect, useState} from 'react';
import {
  Breadcrumb, Card, Col, Row
} from 'react-bootstrap';

import { Redirect } from 'react-router-dom';

import TripCard from './TripCard';
import { isDriver } from '../services/AuthService';
import { getTrips } from '../services/TripService';

function Driver (props) {
    const [trips, setTrips] = useState([]);

    useEffect(() => {
      const loadTrips = async () => {
        const { response, isError } = await getTrips();
        if (isError) {
          setTrips([]);
        } else {
          setTrips(response.data);
        }
      }
      loadTrips();
    }, []); 

    if(!isDriver()) {
        return <Redirect to='/' />
    }
    const getCurrentTrips = () => {
      return trips.filter(trip => {
        return trip.driver !== null && trip.status !== 'COMPLETED';
      });
    }

    // new
    const getRequestedTrips = () => {
      return trips.filter(trip => {
        return trip.status === 'REQUESTED';
      });
    }

    // new
    const getCompletedTrips = () => {
      return trips.filter(trip => {
        return trip.status === 'COMPLETED';
      });
    }

  return (
    <Row>
      <Col lg={12}>
        <Breadcrumb>
          <Breadcrumb.Item href='/'>Home</Breadcrumb.Item>
          <Breadcrumb.Item active>Dashboard</Breadcrumb.Item>
        </Breadcrumb>
        <TripCard
          title='Current Trip'
          trips={getCurrentTrips()}
          group='driver'
          otherGroup='rider'
        />

        <TripCard
          title='Requested Trips'
          trips={getRequestedTrips()}
          group='driver'
          otherGroup='rider'
        />

        <TripCard
          title='Recent Trips'
          trips={getCompletedTrips()}
          group='driver'
          otherGroup='rider'
        />
      </Col>
    </Row>
  );
}

export default Driver;

services/TripServic.js

import axios from 'axios';

import { getAccessToken } from './AuthService';

export const getTrip = async (id) => {
  const url = `/api/trip/${id}/`;
  const token = getAccessToken();
  const headers = { Authorization: `Bearer ${token}` };
  try {
    const response = await axios.get(url, { headers });
    return { response, isError: false };
  } catch (response) {
    return { response, isError: true };
  }
};

export const getTrips = async () => {
  const url = '/api/trip/';
  const token = getAccessToken();
  const headers = { Authorization: `Bearer ${token}` };
  try {
    const response = await axios.get(url, { headers });
    return { response, isError: false };
  } catch (response) {
    return { response, isError: true };
  }
};

when build docker got : if you are behind a proxy, please make sure that the 'proxy' config is set properly

Current Behavior

I want to build a docker-compose for a taxi-app project I'm working on.
and just to be clear I can install any package normally with npm i [any package]
when i run docker-compose up -d --build

Building 52.9s (22/23)
 => [taxi-app_taxi-server internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 359B                                                                                   0.0s 
 => [taxi-app_taxi-server internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 86B                                                                                       0.0s 
 => [taxi-app_taxi-client internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 468B                                                                                   0.0s 
 => [taxi-app_taxi-client internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 119B                                                                                      0.0s 
 => [taxi-app_taxi-server internal] load metadata for docker.io/library/python:3.7.5-alpine                            2.5s 
 => [taxi-app_taxi-client internal] load metadata for docker.io/library/node:16.13.1-alpine                            2.4s 
 => [taxi-app_taxi-client 1/7] FROM docker.io/library/node:16.13.1-alpine@sha256:0e071f3c5c84cffa6b1035023e1956cf28d4  0.0s 
 => [taxi-app_taxi-client internal] load build context                                                                 0.0s 
 => => transferring context: 1.20kB                                                                                    0.0s 
 => [taxi-app_taxi-server internal] load build context                                                                 0.0s 
 => => transferring context: 6.31kB                                                                                    0.0s 
 => [taxi-app_taxi-server 1/7] FROM docker.io/library/python:3.7.5-alpine@sha256:de9fc5bc46cb1a7e2222b976394ea8aa0290  0.0s 
 => CACHED [taxi-app_taxi-client 2/7] RUN mkdir -p /usr/src/app                                                        0.0s 
 => CACHED [taxi-app_taxi-client 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-client 4/7] COPY package.json /usr/src/app/package.json                                      0.0s 
 => CACHED [taxi-app_taxi-client 5/7] COPY package-lock.json /usr/src/app/package-lock.json                            0.0s 
 => ERROR [taxi-app_taxi-client 6/7] RUN npm install --production                                                     50.2s 
 => CACHED [taxi-app_taxi-server 2/7] RUN apk update && apk add build-base python-dev py-pip jpeg-dev zlib-dev openss  0.0s 
 => CACHED [taxi-app_taxi-server 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-server 4/7] COPY ./requirements.txt /usr/src/app                                             0.0s 
 => CACHED [taxi-app_taxi-server 5/7] RUN pip install --upgrade pip                                                    0.0s 
 => CACHED [taxi-app_taxi-server 6/7] RUN pip install -r requirements.txt                                              0.0s 
 => CACHED [taxi-app_taxi-server 7/7] COPY . /usr/src/app                                                              0.0s 
 => [taxi-app_taxi-server] exporting to image                                                                          0.0s 
 => => exporting layers                                                                                                0.0s 
 => => writing image sha256:8e2a1a48d84a0735199a7e2b0cfe562cbcfa5392b595f63023b023ad311cda23                           0.0s 
 => => naming to docker.io/library/taxi-app_taxi-server                                                                0.0s 
------
 > [taxi-app_taxi-client 6/7] RUN npm install --production:
#13 50.06 npm notice
#13 50.06 npm notice New minor version of npm available! 8.1.2 -> 8.3.0
#13 50.06 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
#13 50.06 npm notice Run `npm install -g [email protected]` to update!
#13 50.06 npm notice
#13 50.06 npm ERR! code ERR_SOCKET_TIMEOUT
#13 50.07 npm ERR! network Socket timeout
#13 50.07 npm ERR! network This is a problem related to network connectivity.
#13 50.07 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#13 50.07 npm ERR! network
#13 50.07 npm ERR! network If you are behind a proxy, please make sure that the
#13 50.07 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
#13 50.10
#13 50.10 npm ERR! A complete log of this run can be found in:
#13 50.10 npm ERR!     /root/.npm/_logs/2022-01-07T14_03_29_522Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install --production]: exit code: 
1

Expected Behavior

built the docker container without any problem,

Steps To Reproduce

  1. clone this repro https://github.com/shakori999/taxi-app.git
  2. Run docker-compose up -d --build
  3. See error...
Building 52.9s (22/23)
 => [taxi-app_taxi-server internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 359B                                                                                   0.0s 
 => [taxi-app_taxi-server internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 86B                                                                                       0.0s 
 => [taxi-app_taxi-client internal] load build definition from Dockerfile                                              0.0s 
 => => transferring dockerfile: 468B                                                                                   0.0s 
 => [taxi-app_taxi-client internal] load .dockerignore                                                                 0.0s 
 => => transferring context: 119B                                                                                      0.0s 
 => [taxi-app_taxi-server internal] load metadata for docker.io/library/python:3.7.5-alpine                            2.5s 
 => [taxi-app_taxi-client internal] load metadata for docker.io/library/node:16.13.1-alpine                            2.4s 
 => [taxi-app_taxi-client 1/7] FROM docker.io/library/node:16.13.1-alpine@sha256:0e071f3c5c84cffa6b1035023e1956cf28d4  0.0s 
 => [taxi-app_taxi-client internal] load build context                                                                 0.0s 
 => => transferring context: 1.20kB                                                                                    0.0s 
 => [taxi-app_taxi-server internal] load build context                                                                 0.0s 
 => => transferring context: 6.31kB                                                                                    0.0s 
 => [taxi-app_taxi-server 1/7] FROM docker.io/library/python:3.7.5-alpine@sha256:de9fc5bc46cb1a7e2222b976394ea8aa0290  0.0s 
 => CACHED [taxi-app_taxi-client 2/7] RUN mkdir -p /usr/src/app                                                        0.0s 
 => CACHED [taxi-app_taxi-client 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-client 4/7] COPY package.json /usr/src/app/package.json                                      0.0s 
 => CACHED [taxi-app_taxi-client 5/7] COPY package-lock.json /usr/src/app/package-lock.json                            0.0s 
 => ERROR [taxi-app_taxi-client 6/7] RUN npm install --production                                                     50.2s 
 => CACHED [taxi-app_taxi-server 2/7] RUN apk update && apk add build-base python-dev py-pip jpeg-dev zlib-dev openss  0.0s 
 => CACHED [taxi-app_taxi-server 3/7] WORKDIR /usr/src/app                                                             0.0s 
 => CACHED [taxi-app_taxi-server 4/7] COPY ./requirements.txt /usr/src/app                                             0.0s 
 => CACHED [taxi-app_taxi-server 5/7] RUN pip install --upgrade pip                                                    0.0s 
 => CACHED [taxi-app_taxi-server 6/7] RUN pip install -r requirements.txt                                              0.0s 
 => CACHED [taxi-app_taxi-server 7/7] COPY . /usr/src/app                                                              0.0s 
 => [taxi-app_taxi-server] exporting to image                                                                          0.0s 
 => => exporting layers                                                                                                0.0s 
 => => writing image sha256:8e2a1a48d84a0735199a7e2b0cfe562cbcfa5392b595f63023b023ad311cda23                           0.0s 
 => => naming to docker.io/library/taxi-app_taxi-server                                                                0.0s 
------
 > [taxi-app_taxi-client 6/7] RUN npm install --production:
#13 50.06 npm notice
#13 50.06 npm notice New minor version of npm available! 8.1.2 -> 8.3.0
#13 50.06 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.0>
#13 50.06 npm notice Run `npm install -g [email protected]` to update!
#13 50.06 npm notice
#13 50.06 npm ERR! code ERR_SOCKET_TIMEOUT
#13 50.07 npm ERR! network Socket timeout
#13 50.07 npm ERR! network This is a problem related to network connectivity.
#13 50.07 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#13 50.07 npm ERR! network
#13 50.07 npm ERR! network If you are behind a proxy, please make sure that the
#13 50.07 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
#13 50.10
#13 50.10 npm ERR! A complete log of this run can be found in:
#13 50.10 npm ERR!     /root/.npm/_logs/2022-01-07T14_03_29_522Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install --production]: exit code: 
1

Environment

  • npm:8.3.0
  • Node.js:v16.13.1
  • OS Name: windows 10 x64
  • System Model Name:
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\shako\\AppData\\Roaming\\npm"

; "user" config from C:\Users\shako\.npmrc

http = "http://localhost:3128"
registry = "https://registry.npmjs.org/"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\shako\Desktop\taxi-app\client
; HOME = C:\Users\shako
; Run `npm config ls -l` to show all defaults.

FATAL: role "taxi" does not exist

Current Behavior

Now I'm reading the part 2 chapter 8( I fixed the proxy issue and rebuild the app again)
I tried to run this command docker-compose exec taxi-server python manage.py test trips.tests
I got role 'taxi' does not exist

and this is the output

$ docker-compose exec taxi-server python manage.py test trips.tests
Creating test database for alias 'default'...
/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:310: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use 
the first PostgreSQL database instead.
  RuntimeWarning
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection      
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  role "taxi" does not exist


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 301, in _nodb_cursor
    with super()._nodb_cursor() as cursor:
  File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 620, in _nodb_cursor
    with conn.cursor() as cursor:
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 259, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 235, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection      
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  role "taxi" does not exist


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection      
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  role "taxi" does not exist


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line  
    utility.execute()
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/test.py", line 23, in run_from_argv
    super().run_from_argv(argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/test.py", line 55, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/local/lib/python3.7/site-packages/django/test/runner.py", line 725, in run_tests
    old_config = self.setup_databases(aliases=databases)
  File "/usr/local/lib/python3.7/site-packages/django/test/runner.py", line 645, in setup_databases
    debug_sql=self.debug_sql, parallel=self.parallel, **kwargs
  File "/usr/local/lib/python3.7/site-packages/django/test/utils.py", line 183, in setup_databases
    serialize=connection.settings_dict['TEST'].get('SERIALIZE', True),
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/creation.py", line 57, in create_test_db
    self._create_test_db(verbosity, autoclobber, keepdb)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/creation.py", line 191, in _create_test_db
    with self._nodb_cursor() as cursor:
  File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 319, in _nodb_cursor
    with conn.cursor() as cursor:
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 259, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 235, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection      
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  role "taxi" does not exist

Expected Behavior

run tasks without any issues

Steps To Reproduce

  1. clone this repo https://github.com/shakori999/taxi-app.git
  2. Run docker-compose exec taxi-server python manage.py test trips.tests
  3. See error...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.