serveless aws gcp speed

This problem, let me think my stupid manager and Smart Information Security Consultant before company. Information Security Consultant Say GCP is very safe… Ya safe so customer lose.

繼續閱讀

If you want to control severity at LoggingWinston. https://stackoverflow.com/questions/58055551/structured-logs-in-google-cloud-run-not-being-parsed-using-winston-for-logging const winston = require('winston'); const useFormat = winston.format.combine( winston.format((info, opts) => { let level = info.level.toUpperCase(); if(level === 'VERBOSE') { level = 'DEBUG'; } info['severity'] = level; delete info.level; return info; })(), winston.format.json()); const { LoggingWinston } = require('@google-cloud/logging-winston'); const loggingWinston = new LoggingWinston(); const logger = winston.createLogger({ level: 'debug', format: useFormat, transports: [ new winston.transports.Console(), loggingWinston ] });

繼續閱讀

oooxxxoooxxx: vpc Connector name aaabbbaaabbb: your firebase project Firebase deploy default vpcConnector vpc-Connector node_modules\firebase-tools\lib\gcp\cloudfunctions.js  _createFunction  const data ADD  vpcConnector: ‘oooxxxoooxxx’, Failed gcloud VPC VPC_CONNECTOR=dosportsapi-redis01 projects/aaabbbaaabbb/locations/us-central1/connectors/oooxxxoooxxx gcloud beta functions deploy api \ --runtime nodejs10 \ --trigger-http \ --region us-central1 \ --vpc-connector $VPC_CONNECTOR \ --egress-settings private-ranges-only \ --memory 2048MB

繼續閱讀

http://liu-xin.me/2017/03/24/%E8%AE%A9%E5%86%99%E5%85%A5%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E6%95%B0%E6%8D%AE%E8%87%AA%E5%8A%A8%E5%86%99%E5%85%A5%E7%BC%93%E5%AD%98/``` const to = require(‘await-to-js’).default; const Redis = require(‘ioredis’); const redis = new Redis(ooxxooxx); function Cache() {} Cache.get = async function(key) { const [err, res] = await to(redis.get(key)); if (err) {console.error(‘REDIS::Cache::get]’, err); return null;} return JSON.parse(res); }; Cache.set = async function(key, value) { value = JSON.stringify(value); const [err] = await to(redis.set(key, value)); if (err) {console.error(‘REDIS::Cache::set]’, err); } }; // // sequelize.query // async function CacheSequelizeQuery(sequelize, sql, params, redisKey) { const cacheData = await Cache.

繼續閱讀

https://github.com/luin/ioredis``` const Redis = require(‘ioredis’); const redis = new Redis(); const delScript = local all_keys = {}; local keys = {}; local done = false; local cursor = "0" repeat local result = redis.call("SCAN", cursor, "match", KEYS[1], "count", KEYS[2]) cursor = result[1]; keys = result[2]; for i, key in ipairs(keys) do all_keys[#all_keys+1] = key; end if cursor == "0" then done = true; end until done for i, key in ipairs(all_keys) do redis.

繼續閱讀

https://stackoverflow.com/questions/6600868/set-default-value-of-javascript-object-attributes``` // default num: 0, unit: ‘pics’ function items(op) { const { num, unit } = Object.assign({}, { num: 0, unit: ‘pics’}, op); }

繼續閱讀

作者的圖片

Sue boy

Sueboy Can support You

CIO

Taiwan