Skip to content

Serverless support #77

@jonatanrdsantos

Description

@jonatanrdsantos

I'm getting this error wen using seriate with aws serverless functions:

TypeError: SqlContext Error. Failed on step "__result__" with: "Cannot read property 'pool' of null"

The class:

import seriate from 'seriate';

export default class SomethingSQLServer {
  constructor() {
    this.seriateService = seriate;
    this.dbconfig = {
      server: process.env.SQL_SERVER_ENDPOINT,
      user: process.env.SQLSERVER_USERNAME,
      password: process.env.SQLSERVER_PASSWORD,
      database: process.env.PRODUCTS_DATABASE,
      requestTimeout: 500000,
    };
    console.log('testing =>', this.dbconfig);
    // this.seriateService.setDefaultConfig(this.dbconfig);
  }

  createSomething(somethingElse) {
    return seriate.execute(this.dbconfig, {
      // stream: true,
      preparedSql: `INSERT INTO SOMETHING.dbo.SOMETHING_TABLE
        (ds_something)
        VALUES (@something)`,
      params: {
        something: {
          val: somethingElse.something,
          type: seriate.NVARCHAR,
        },
      },
    });
  }
  
}

Always i'm getting:

TypeError: SqlContext Error. Failed on step "__result__" with: "Cannot read property 'pool' of null"

Anyone with the same error? Any soluction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions