Guest User

Untitled

a guest
Sep 12th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. {"message":"Error validating selections: s.sql is not a function","level":"error"}
  2.  
  3. const mysqlx = require('@mysql/xdevapi')
  4. const logger = require('./logger')
  5.  
  6. const {
  7. MYSQL_USER,
  8. MYSQL_PASSWORD,
  9. MYSQL_HOST,
  10. MYSQL_PORT,
  11. MYSQL_SCHEMA
  12. } = process.env
  13.  
  14. const session = mysqlx.getSession({
  15. user: MYSQL_USER,
  16. password: MYSQL_PASSWORD,
  17. host: MYSQL_HOST,
  18. port: parseInt(MYSQL_PORT)
  19. })
  20. .catch(e => logger.error('Error connecting to database:', e))
  21.  
  22. exports.validateSelections = selections =>
  23. session
  24. .then(s => s
  25. .getSchema(MYSQL_SCHEMA)
  26. .sql('SELECT * FROM affiliate_links WHERE id = 1')
  27. .execute()
  28. )
Add Comment
Please, Sign In to add comment