GithubHelp home page GithubHelp logo

ticketing's Issues

Kubernetes - MongooseServerSelectionError: connect ECONNREFUSED

I try to connect the mongodb in my pod of kubernetes but get the error:

MongooseServerSelectionError: connect ECONNREFUSED

My Pods and Services:

NAME                               READY   STATUS    RESTARTS   AGE
auth-depl-5cc58f4f86-22hn6         1/1     Running   0          6m52s
auth-mongo-depl-69cb9cccc7-s8qw7   1/1     Running   0          6m52s
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
auth-mongo-srv   ClusterIP   10.111.58.252   <none>        27017/TCP   8m12s
auth-srv         ClusterIP   10.102.134.66   <none>        3000/TCP    8m12s
kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP     3d1h

My Mongo Deployment file: auth-mongo-depl.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-mongo-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth-mongo
  template:
    metadata:
      labels:
        app: auth-mongo
    spec:
      containers:
        - name: auth-mongo
          image: mongo
---
apiVersion: v1
kind: Service
metadata:
  name: auth-mongo-srv
spec:
  selector:
    app: auth-mongo
  ports:
    - name: db
      protocol: TCP
      port: 27017
      targetPort: 27017

My app:

const start = async () => {
  try {
    await mongoose.connect('mongodb://auth-mongo-srv:27017/auth');
    console.log('Connected to MongoDb');
  } catch (error) {
    console.error(error);
  }

  app.listen(3000, () => {
    console.log('Listening on port 3000!!!!');
  });
};

I got the error when deploying auth-mongo-depl

[auth]MongooseServerSelectionError: connect ECONNREFUSED 10.111.58.252:27017
[auth]    at _handleConnectionErrors (/app/node_modules/mongoose/lib/connection.js:829:11)
[auth]    at NativeConnection.openUri (/app/node_modules/mongoose/lib/connection.js:804:11) {
[auth]  reason: TopologyDescription {
[auth]    type: 'Unknown',
[auth]    servers: Map(1) { 'auth-mongo-srv:27017' => [ServerDescription] },
[auth]    stale: false,
[auth]    compatible: true,
[auth]    heartbeatFrequencyMS: 10000,
[auth]    localThresholdMS: 15,
[auth]    setName: null,
[auth]    maxElectionId: null,
[auth]    maxSetVersion: null,
[auth]    commonWireVersion: 0,
[auth]    logicalSessionTimeoutMinutes: null
[auth]  },

How can I connect the mongodb in Kubernetes ?

Can't get "Set-Cookie" header from response in signin route

I can't get Set-Cookie header for response, it generates this error:
image

I tried different casings like "set-cookie", "Set-COOKIE" and etc., the result is the same.

I tried doing console.log(response.headers), and it turns out that "Set-Cookie" is not among the headers at all:
image

Though, in Postman everything is working correctly without any issues.

I heard supertest doesn't work very well with cookies.
Is this an issue caused by supertest itself? What can I do to tackle the issue?

Any help is appreciated.

Source code

Typescript error

Type 'Document<any, {}>' is not assignable to type 'Condition<LeanDocument> | undefined'.
2021-05-07 20_22_32-โ— ticket ts - Untitled (Workspace) - Visual Studio Code

I am getting this error in ticket.ts (order service) where I try to look for existingOrder before creating new one as part of isReserved method.

I've added //@ts-ignore to make it go away. But is it a way to go?

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.