함수 만들기를 클릭하여 새 Node.js 또는 Python 함수를 만들거나 기존 Node.js 또는 Python 함수를 선택하고 수정을 클릭하여 수정합니다.
다음을 클릭하여 코드 수정 페이지로 이동합니다.
함수 테스트를 클릭하여 테스트 프로세스를 시작합니다.
메시지가 표시되면 테스트 시작을 클릭하여 Cloud Shell 터미널 사용을 승인합니다.
테스트 실행
위 단계를 완료하면 트리거 이벤트 패널이 오른쪽에 열리고 함수를 테스트할 준비가 되었음을 확인합니다. 테스트 실행을 클릭합니다.
이 테스트 프로세스 단계에는 다음 구성요소가 포함됩니다.
트리거 이벤트 패널. 트리거 이벤트 패널은 구성 페이지에서 지정한 이벤트 트리거와 일치하는 페이로드로 자동 입력됩니다. 이는 함수의 입력입니다.
Cloud Shell 출력 창. Cloud Shell 출력 창에는 HTTP 상태 코드와 호출자에게 반환된 모든 응답이 표시됩니다.
테스트 실행은 테스트를 실행합니다.
Cloud Shell 창에서 테스트의 출력을 확인할 수 있습니다.
Cloud Shell 터미널
화면 하단의 Cloud Shell 터미널에서 함수별 로깅 출력을 볼 수 있습니다. 예를 들어 테스트 패널을 열면 소스 코드 패키징 출력이 표시됩니다. 테스트를 실행하면 소스 코드 변경사항과 console.log 및 오류를 포함한 실행 수준 출력이 표시됩니다.
테스트가 실패하면 Cloud Shell에 오류 메시지가 표시되어 정확한 원인을 파악하는 데 도움이 됩니다. 예를 들면 다음과 같습니다.
[11:31:47 AM] - Provided module can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /workspace/index.js:11
: 'World';
^
SyntaxError: Unexpected token ':'
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1048:15)
at Module._compile (node:internal/modules/cjs/loader:1083:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12)
at Module.require (node:internal/modules/cjs/loader:1021:19)
at require (node:internal/modules/cjs/helpers:103:18)
at getUserFunction (/workspace/node_modules/@google-cloud/functions-framework/build/src/loader.js:98:30)
at async main (/workspace/node_modules/@google-cloud/functions-framework/build/src/main.js:35:32)
[11:31:47 AM] - Could not load the function, shutting down.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-04-17(UTC)"],[[["This guide demonstrates how to test Node.js and Python Cloud Run functions within the Google Cloud console before deployment, ensuring functionality."],["The testing process includes a triggering event panel with pre-populated payload, a Cloud Shell output window for HTTP status and responses, and a \"Run test\" button to execute the test."],["Cloud Shell terminal logs provide detailed output, showing source code packaging and execution data, including `console.log` outputs and potential error messages to aid in debugging."],["If tests fail, the Cloud Shell terminal displays specific error messages to help pinpoint issues, suggesting code review and test re-runs or a complete restart if the problem persists."],["The Cloud Run functions testing is currently under a \"Pre-GA Offerings Terms\", meaning that the feature is \"as-is\" with potential limited support."]]],[]]