sless-primer/POSTGRES/code/stress-js-badenv/stress_js_badenv.js
Naeel 4b04cde84b chore(examples): remove stale examples, keep only POSTGRES
- Deleted: TNAR, demo-event-log, demo-managed-functions, hello-go, hello-node,
  k8s, notes-python, pg-list-python, simple-node, simple-python
- POSTGRES: removed luceUNDnode.tf (commented-out legacy), stress_log_1.txt,
  funcs_list.py; disabled stress_destroy_apply.sh (PG lifecycle stress has
  delete_user bug); added README.md
- examples/README.md: updated to reflect current state (sless_service + sless_job)
2026-03-21 07:49:23 +03:00

18 lines
780 B
JavaScript

// 2026-03-19
// stress_js_badenv.js — читает несуществующую переменную env и падает.
// Проверяет: платформа перехватывает TypeError/undefined, возвращает 500.
//
// Entrypoint: stress_js_badenv.run
'use strict';
exports.run = async (event) => {
const crash = event.crash !== false; // по умолчанию crash=true
if (crash) {
// Читаем несуществующий env, пытаемся вызвать .toUpperCase() на undefined
const val = process.env.THIS_VAR_DOES_NOT_EXIST_AT_ALL;
return { shout: val.toUpperCase() }; // TypeError: Cannot read properties of undefined
}
return { runtime: 'nodejs20', version: 'v1', crashed: false };
};