Blueprint 상세 가이드
Blueprint 개요
Cloud Functions 생성 시 Blueprint를 설정하여 Cloud Functions에서 제공하는 Runtime 소스코드를 활용할 수 있습니다. Cloud Functions에서 제공하는 Blueprint 항목은 다음을 참조하세요.
| 구분 | 상세 설명 | 비고 |
|---|---|---|
| Hello World | 함수 호출 시 Hello Serverless World!를 응답합니다. | |
| Execution after timeout | 함수 호출 시간이 초과된 후에 실행되어야 하지만 실행되지 않는 코드를 출력합니다. | PHP, Python 미지원 |
| HTTP request body | Request Body를 파싱합니다. | PHP 미지원 |
| Send HTTP requests | Cloud 함수에서 HTTP 요청을 전송합니다. | PHP 미지원 |
| Print logs | 사용자의 Samsung Cloud Platform Console Request를 로그로 출력합니다. | PHP 미지원 |
| Throw a custom error | 에러 로직을 직접 입력하여 에러를 처리합니다. | |
| Using Environment Variable | Cloud 함수 내에 환경 변수를 구성하여 실행합니다. |
Hello World
Hello World 응답 받기 설정 및 함수 호출 예시(함수 URL 이용)를 설명합니다.
Hello World 설정하기
Hello World를 설정하려면 다음 절차를 따르세요.
모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
Function 목록 페이지에서 URL로 호출할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
구성 탭을 클릭한 후, 함수 URL 항목의 수정 버튼을 클릭하세요. 함수 URL 수정 팝업창이 열립니다.
함수 URL 수정 팝업창에서 활성화 여부를 사용으로 설정한 후, 확인 버튼을 클릭하세요.
구분 상세 설명 활성화 여부 함수 URL의 사용 여부를 설정 인증 유형 함수 URL에 대한 요청 시 IAM 인증 사용 여부 선택 접근 제어 접근 가능한 IP를 추가하여 관리 가능 - 사용으로 설정한 후, 퍼블릭 접근 IP 입력 및 추가 가능
표. 트리거 추가 시 필수 입력 항목코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify('Hello Serverless World!'), }; return response; };exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify('Hello Serverless World!'), }; return response; };Hello World - Node.js 소스코드 - Python 소스코드배경색 변경
import json def handle_request(params): # User writing area (Function details) return { 'statusCode': 200, 'body': json.dumps('Hello Serverless World!') }import json def handle_request(params): # User writing area (Function details) return { 'statusCode': 200, 'body': json.dumps('Hello Serverless World!') }Hello World - Python 소스코드 - PHP 소스코드배경색 변경
<?php function handle_request() { # User writing area (Function details) $res = array( 'statusCode' => 200, 'body' => 'Hello Serverless World!', ); return $res; } ?><?php function handle_request() { # User writing area (Function details) $res = array( 'statusCode' => 200, 'body' => 'Hello Serverless World!', ); return $res; } ?>Hello World - PHP 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, 응답을 확인합니다.
Hello Serverless World!
Execution after timeout
제한시간 이후 함수 실행(Execution after timeout) 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
Execution after timeout 설정하기
Execution after timeout을 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ console.log("Hello world 3"); await delay(3000); const response = { statusCode: 200, body: JSON.stringify('Hello Serverless World!'), }; return response; }; const delay = (ms) => { return new Promise(resolve=>{ setTimeout(resolve,ms) }) }exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ console.log("Hello world 3"); await delay(3000); const response = { statusCode: 200, body: JSON.stringify('Hello Serverless World!'), }; return response; }; const delay = (ms) => { return new Promise(resolve=>{ setTimeout(resolve,ms) }) }Execution after timeout - Node.js 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출하고 일정 시간이 지난 후, 응답을 확인합니다.
Hello Serverless World!
HTTP request body
Request Body 파싱하기 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
HTTP request body 설정하기
HTTP request body를 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify(params.body), }; return response; };exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify(params.body), }; return response; };Execution after timeout - Node.js 소스코드 - Python 소스코드배경색 변경
import json def handle_request(params): # User writing area (Function details) return { 'statusCode': 200, 'body': json.dumps(params.json) }import json def handle_request(params): # User writing area (Function details) return { 'statusCode': 200, 'body': json.dumps(params.json) }Execution after timeout - Python 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, Body 데이터와 요청 Body값, 응답 Body값을 확인합니다.
요청 Body값
배경색 변경{ "testKey" :"cloud-001", "testNames": [ { "name": "Son" }, { "name": "Kim" } ], "testCode":"test" }{ "testKey" :"cloud-001", "testNames": [ { "name": "Son" }, { "name": "Kim" } ], "testCode":"test" }요청 Body 값 응답 Body값
배경색 변경{ "testKey" :"cloud-001", "testNames": [ { "name": "Son" }, { "name": "Kim" } ], "testCode":"test" }{ "testKey" :"cloud-001", "testNames": [ { "name": "Son" }, { "name": "Kim" } ], "testCode":"test" }응답 Body 값
Send HTTP requests
HTTP 요청하기 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
Send HTTP requests 설정하기
Send HTTP requests를 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
const request = require('request'); /** * @description User writing area (Function details) */ exports.handleRequest = async function (params) { return await sendRequest(params); }; async function sendRequest(req) { return new Promise((resolve, reject) => { // Port 80 and Port 443 are available url = "https://example.com"; // Destination URL const options = { uri: url, method:'GET', json: true, strictSSL: false, rejectUnauthorized: false } request(options, (error, response, body) => { if (error) { reject(error); } else { resolve({ statusCode: response.statusCode, body: JSON.stringify(body) }); } }); }); }const request = require('request'); /** * @description User writing area (Function details) */ exports.handleRequest = async function (params) { return await sendRequest(params); }; async function sendRequest(req) { return new Promise((resolve, reject) => { // Port 80 and Port 443 are available url = "https://example.com"; // Destination URL const options = { uri: url, method:'GET', json: true, strictSSL: false, rejectUnauthorized: false } request(options, (error, response, body) => { if (error) { reject(error); } else { resolve({ statusCode: response.statusCode, body: JSON.stringify(body) }); } }); }); }Send HTTP requests - Node.js 소스코드 - Python 소스코드배경색 변경
import json import requests def handle_request(params): # User writing area (Function details) # Port 80 and Port 443 are available url = "https://example.com" # Destination URL try: response = requests.get(url, verify=True) return { 'statusCode': response.status_code, 'body': json.dumps(response.text) } except requests.exceptions.RequestException as e: return str(e)import json import requests def handle_request(params): # User writing area (Function details) # Port 80 and Port 443 are available url = "https://example.com" # Destination URL try: response = requests.get(url, verify=True) return { 'statusCode': response.status_code, 'body': json.dumps(response.text) } except requests.exceptions.RequestException as e: return str(e)Send HTTP requests - Python 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, 응답을 확인합니다.
<!doctype html>
<html>
<head>
<title>Example Domain</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html><!doctype html>
<html>
<head>
<title>Example Domain</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>Print logs
Log 출력하기 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
Print logs 설정하기
Print logs 응답 받기를 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
const winston = require('winston'); // Log module setting const logger = winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.printf(info => info.timestamp + ' ' + info.level + ': ' + info.message) ), transports: [ new winston.transports.Console() ] }); exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify(params.body), }; logger.info(JSON.stringify(response, null, 2)); return response; };const winston = require('winston'); // Log module setting const logger = winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.printf(info => info.timestamp + ' ' + info.level + ': ' + info.message) ), transports: [ new winston.transports.Console() ] }); exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ const response = { statusCode: 200, body: JSON.stringify(params.body), }; logger.info(JSON.stringify(response, null, 2)); return response; };Print logs - Node.js 소스코드 - Python 소스코드배경색 변경
import json import logging # Log module setting logging.basicConfig(level=logging.INFO) def handle_request(params): # User writing area (Function details) response = { 'statusCode': 200, 'body': json.dumps(params.json) } logging.info(response) return responseimport json import logging # Log module setting logging.basicConfig(level=logging.INFO) def handle_request(params): # User writing area (Function details) response = { 'statusCode': 200, 'body': json.dumps(params.json) } logging.info(response) return responsePrint logs - Python 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, 로그 탭에서 로그를 확인합니다.
[2023-09-07] 12:06:23] "host": "scf-xxxxxxxxxxxxxxxxxxxxx",
[2023-09-07] 12:06:23] "ce-id": "xxxxxxxxxxxxxxxxxxxxx",
[2023-09-07] 12:06:23] "ce-source": "xxxxxxxxxxxxxxxxxxxxx",[2023-09-07] 12:06:23] "host": "scf-xxxxxxxxxxxxxxxxxxxxx",
[2023-09-07] 12:06:23] "ce-id": "xxxxxxxxxxxxxxxxxxxxx",
[2023-09-07] 12:06:23] "ce-source": "xxxxxxxxxxxxxxxxxxxxx",Throw a custom error
커스텀 에러 발생(Throw a custom error) 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
Throw a custom error 설정하기
Throw a custom error를 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
class CustomError extends Error { constructor(message) { super(message); this.name = 'CustomError'; } } exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ throw new CustomError('This is a custom error!'); };class CustomError extends Error { constructor(message) { super(message); this.name = 'CustomError'; } } exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ throw new CustomError('This is a custom error!'); };Throw a custom error - Node.js 소스코드 - Python 소스코드배경색 변경
class CustomError(Exception): def __init__(self, message): self.message = message def handle_request(parmas): raise CustomError('This is a custom error!')class CustomError(Exception): def __init__(self, message): self.message = message def handle_request(parmas): raise CustomError('This is a custom error!')Throw a custom error - Python 소스코드 - PHP 소스코드배경색 변경
<?php class CustomError extends Exception { public function __construct($message) { parent::__construct($message); $this->message = $message; } } function handle_request() { throw new CustomError('This is a custom error!'); } ?><?php class CustomError extends Exception { public function __construct($message) { parent::__construct($message); $this->message = $message; } } function handle_request() { throw new CustomError('This is a custom error!'); } ?>Throw a custom error - PHP 소스코드
- Node.js 소스코드
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, 로그 탭에서 에러 발생 여부를 확인합니다.
Using Environment Variable
환경 변수 사용(Using Environment Variable) 설정 및 함수 호출 예시(함수 URL 사용)를 설명합니다.
Using Environment Variable 설정하기
Using Environment Variable를 설정하려면 다음 절차를 따르세요.
- 모든 서비스 > Compute > Cloud Functions 메뉴를 클릭하세요. Cloud Functions의 Service Home 페이지로 이동합니다.
- Service Home 페이지에서 Function 메뉴를 클릭하세요. Function 목록 페이지로 이동합니다.
- Function 목록 페이지에서 트리거를 설정할 자원을 클릭하세요. Function 상세 페이지로 이동합니다.
- 트리거 탭을 클릭한 후, 트리거 추가 버튼을 클릭하세요. 트리거 추가 팝업창이 열립니다.
- 트리거 추가 팝업창에서 트리거 종류 항목을 선택한 후, 하단에 표시되는 필수 정보를 입력하고 확인 버튼을 클릭하세요.
- 필수 정보는 트리거 종류에 따라 달라집니다.
트리거 종류 입력 항목 API Gateway - API명: 기존에 생성된 API를 선택하거나 새로 생성 가능
- 스테이지: 기존에 생성된 스테이지를 선택하거나 새로 생성 가능
Cronjob - 예시를 참고하여 트리거의 반복 빈도(분, 시, 일, 월, 요일)를 입력
- Timezone 설정: 적용할 기준 시간대를 선택
표. 트리거 추가 시 필수 입력 항목
- 필수 정보는 트리거 종류에 따라 달라집니다.
- 코드 탭으로 이동한 후, 수정 버튼을 클릭하세요. Function 코드 수정 페이지로 이동합니다.
- 성공 및 실패 케이스에 대한 처리 로직을 추가한 후, 저장 버튼을 클릭하세요.
- Node.js 소스코드배경색 변경
exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ return process.env.test; };exports.handleRequest = async function (params) { /** * @description User writing area (Function details) */ return process.env.test; };Using Environment Variable - Node.js 소스코드 - Python 소스코드배경색 변경
import json import os def handle_request(params): # User writing area (Function details) return os.environ.get("test")import json import os def handle_request(params): # User writing area (Function details) return os.environ.get("test")Using Environment Variable - Python 소스코드 - PHP 소스코드배경색 변경
import json def handle_request(params): # User writing area (Function details) return os.environ.get("test")import json def handle_request(params): # User writing area (Function details) return os.environ.get("test")Using Environment Variable - PHP 소스코드
- Node.js 소스코드
- 구성 탭으로 이동한 후, 환경 변수 영역의 수정 버튼을 클릭하세요. 환경 변수 수정 팝업창이 열립니다.
- 환경 변수 정보를 입력한 후, 확인 버튼을 클릭하세요.
구분 상세 설명 이름 Key값을 입력 값 Value값을 입력 표. 환경 변수 입력 항목
함수 호출 확인하기
Function 상세 페이지의 구성 탭에서 함수 URL을 호출한 후, 로그 탭에서 환경 변수값을 확인합니다.