Giter Site home page Giter Site logo

free-session-backend's People

Contributors

dcdunkan avatar knorpelsenf avatar roziscoding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

waptik

free-session-backend's Issues

FetchError: request to https://grammy-free-session.deno.dev/session/5678018896 failed, reason: socket hang up

Every time /reset is run i get a FetchError.

Code Piece:

type MyContext = Context & ConversationFlavor & SessionFlavor<SessionData> & EmojiFlavor<Context>;
type MyConversation = Conversation<MyContext>;

interface SystemUser {
	cnpj: string,
	name: string,
	internalId: string
}

interface Product {
	id: number,
	name: string,
	value: number,
	stock: number
}

interface ProductRequest {
	id: number,
	quantity: number

const bot = new Bot<MyContext>(`${process.argv[2]}`)

interface SessionData {
	Request: ProductRequest[],
	MessageList: number[],
	User: UsuarioSistema
}

bot.use(
	session({
		initial(): SessionData {
			return {
				Request: [],
				MessageList: [],
				User: {
					cnpj: "",
					name: "",
					internalId: ""
				}
			}
		},
		storage: freeStorage<SessionData>(bot.token)
	})
)

bot.command("reset", async (ctx)=>{
	(ctx as any).session = undefined;
});

Log:

FetchError: request to https://grammy-free-session.deno.dev/session/5678018896 failed, reason: socket hang up
    at ClientRequest.<anonymous> (/root/BOT/Telegram/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketOnEnd (node:_http_client:512:9)
    at TLSSocket.emit (node:events:525:35)
    at TLSSocket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  error: FetchError: request to https://grammy-free-session.deno.dev/session/5678018896 failed, reason: socket hang up
      at ClientRequest.<anonymous> (/root/BOT/Telegram/node_modules/node-fetch/lib/index.js:1491:11)
      at ClientRequest.emit (node:events:513:28)
      at ClientRequest.emit (node:domain:489:12)
      at TLSSocket.socketOnEnd (node:_http_client:512:9)
      at TLSSocket.emit (node:events:525:35)
      at TLSSocket.emit (node:domain:489:12)
      at endReadableNT (node:internal/streams/readable:1359:12)
      at processTicksAndRejections (node:internal/process/task_queues:82:21) {
    type: 'system',
    errno: 'ECONNRESET',
    code: 'ECONNRESET'
  },
  ctx: Context {
    update: { update_id: 807309994, message: [Object] },
    api: Api { raw: {}, config: [Object] },
    me: {
      id: [redacted],
      is_bot: true,
      first_name: '[redacted]',
      username: '[redacted]',
      can_join_groups: true,
      can_read_all_group_messages: false,
      supports_inline_queries: false
    },
    session: [Getter/Setter],
    conversation: ConversationControls {
      session: [Function (anonymous)],
      enter: [AsyncFunction (anonymous)],
      [Symbol(conversations)]: [Object]
    },
    emoji: [Function: withEmoji],
    replyWithEmoji: [Function (anonymous)],
    match: ''
  },
  name: 'BotError'
}

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.