오류가 발생한 특정 API 프록시의 모든 PythonScript 정책을 검사합니다. <ResourceURL> 또는 <IncludeURL> 요소에 지정된 리소스 URL이 위의 1단계에서 식별된 잘못된 항목과 일치하는 PythonScript 정책이 있는 경우 이는 오류의 원인이 됩니다.
예를 들어 다음 정책은 리소스 URL을 py:myscript.py로 지정하며 오류 메시지의 내용과 일치합니다.
<ResourceURL> 및 <IncludeURL> 요소가 존재하지 않는 PythonScript 파일을 참조하는 경우 API 프록시 배포가 실패합니다.
로컬 머신에서 프록시 번들을 배포하는 경우 PythonScript 소스 파일을 /apiproxy/resources/py(API 프록시 범위)에 저장해야 합니다.
Apigee UI에서 PythonScript 소스 파일은 아래와 같이 API 프록시 편집기의 탐색창에서 스크립트 섹션의 py 아래에 표시됩니다.
또한 리소스 파일을 환경 수준 저장소에 저장할 수 있습니다(예: 환경의 모든 프록시에서 PythonScript 코드를 사용할 수 있음). 정책에 지정된 리소스 파일을 찾을 수 없는 경우 이 오류가 발생합니다.
진단
오류가 발생한 PythonScript 정책과 잘못된 리소스 URL 참조를 확인합니다. 이 정보는 오류 메시지에서 확인할 수 있습니다. 예를 들어 다음 오류에서 정책 이름은 Python_script이고 잘못된 리소스 URL 참조는 py://myscript.py입니다.
1단계에서 식별된 파일이 특정 API 프록시 번들에 포함되어 있는지 또는 환경 범위에 있는지 확인합니다.
파일이 특정 API 프록시 번들의 일부인지 확인하려면 다음 단계 중 하나를 따르세요.
Apigee UI에서 이 파일이 API 프록시의 스크립트 섹션에 있는지 확인합니다.
API 프록시 번들을 다운로드하고 파일이 있는지 검색합니다.
파일이 특정 API 프록시 번들의 일부가 아닌 경우 해당 파일이 환경 수준에 있는지 확인합니다. 이 조사를 위해 Resource Files API를 사용할 수 있습니다.
API 프록시 또는 환경 수준에 파일이 없는 경우 이는 오류의 원인이 됩니다.
위의 예시에서 잘못된 PythonScript 파일 이름은 myscript.py입니다. 아래 스크린샷에서는 정책에서 리소스 URL로 지정된 파일이 스크립트 섹션에 나타나지 않습니다. 또한 환경 수준에서 파일이 존재하지 않습니다. 따라서 API 프록시 배포에 실패하고 오류가 발생합니다.
<ResourceURL> 및 <IncludeURL> 요소에 지정된 PythonScript 파일이 API 프록시 또는 환경 수준에 있는 유효한 파일을 참조하는지 확인합니다.
위에 나온 PythonScript 정책 예시를 수정하려면 API 프록시 번들에 myscript.py 파일을 추가하세요. 아래 스크린샷에서는 <ResourceURL> 및 <IncludeURL> 요소에 지정된 PythonScript 파일을 API 프록시 번들의 스크립트 섹션에 볼 수 있습니다.
[[["이해하기 쉬움","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-09-05(UTC)"],[[["\u003cp\u003eThis documentation addresses common deployment errors in Apigee and Apigee hybrid related to PythonScript policies.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eInvalidResourceUrlFormat\u003c/code\u003e error occurs when the \u003ccode\u003e<ResourceURL>\u003c/code\u003e or \u003ccode\u003e<IncludeURL>\u003c/code\u003e format in a PythonScript policy is incorrect, such as using \u003ccode\u003epy:filename.py\u003c/code\u003e instead of \u003ccode\u003epy://filename.py\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eInvalidResourceUrlReference\u003c/code\u003e error occurs when a PythonScript policy's \u003ccode\u003e<ResourceURL>\u003c/code\u003e or \u003ccode\u003e<IncludeURL>\u003c/code\u003e points to a file that does not exist within the API proxy bundle or the environment level.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve these issues, ensure that resource URLs follow the \u003ccode\u003epy://filename.py\u003c/code\u003e format and that referenced Python files are located within the API proxy's Scripts section or at the environment level.\u003c/p\u003e\n"]]],[],null,["# PythonScript policy deployment error troubleshooting\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/deployment/python-script-deployment-errors) documentation.*\n| Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nInvalidResourceUrlFormat\n------------------------\n\n### Error message\n\nDeployment of an API proxy through either the Apigee UI or API fails with this error message: \n\n```python\nError Deploying Revision revision_number to environment\nInvalid resource url format. Resource url is invalid_URL.\n```\n\n### Example error message\n\n```python\nError Deploying Revision 2 to prod\nInvalid resource url format. Resource url is py:myscript.py.\n```\n\n### Example screenshot\n\n### Cause\n\nIf the format of the resource URL specified within the `\u003cResourceURL\u003e` or the `\u003cIncludeURL\u003e` element of the\n[PythonScript policy](/apigee/docs/api-platform/reference/policies/python-script-policy) is invalid, then the deployment of the API proxy fails.\n\nThe correct format is as shown below: \n\n```python\n\u003cResourceURL\u003epy://file_name.py\u003c/ResourceURL\u003e\n\u003cIncludeURL\u003epy://file_name.py\u003c/IncludeURL\u003e\n```\n\nFor example, if the `\u003cResourceURL\u003e` element is specified as shown below, then the\ndeployment of the API proxy fails because it does not follow the required pattern: \n\n```python\n\u003cResourceURL\u003epy:myscript.py\u003c/ResourceURL\u003e\n```\n\n### Diagnosis\n\n1. Identify the invalid resource URL format used in the PythonScript policy. You can find this information from the error message. For example, in the following error, the invalid resource URL format is `py:myscript.py`:\n\n ```python\n Invalid resource url format. Resource url is py:myscript.py.\n ```\n2. Examine all the PythonScript policies in the specific API Proxy where the failure has occurred. If there is any PythonScript policy in which the resource URL specified in the `\u003cResourceURL\u003e` or the `\u003cIncludeURL\u003e` element matches the invalid entry identified in step #1 above, then that's the cause of the error.\n\n For example, the following policy specifies the resource URL as `py:myscript.py`, which matches what's in the error message: \n\n ```python\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cScript async=\"false\" continueOnError=\"false\" enabled=\"true\" timeLimit=\"200\" name=\"py-TotalVariable\"\u003e\n \u003cDisplayName\u003epy-TotalVariable\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cResourceURL\u003epy:myscript.py\u003c/ResourceURL\u003e\n \u003c/Script\u003e\n ```\n\n Since the resource URL is specified as `py:myscript.py`, which is invalid, the deployment of the API Proxy fails with the error: \n\n ```python\n Invalid resource url format. Resource url is py:myscript.py.\n ```\n\n### Resolution\n\nEnsure that the resource URL format specified in the `\u003cResourceURL\u003e` element of the PythonScript policy is valid. For example: \n\n```python\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cScript async=\"false\" continueOnError=\"false\" enabled=\"true\" timeLimit=\"200\" name=\"py-TotalVariable\"\u003e\n \u003cDisplayName\u003epy-TotalVariable\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cResourceURL\u003epy://myscript.py\u003c/ResourceURL\u003e\n\u003c/Script\u003e\n```\n\nInvalidResourceUrlReference\n---------------------------\n\n### Error message\n\nDeployment of an API proxy through either the Apigee UI or API fails with this error message: \n\n```python\nError Deploying Revision revision_number to environment\nInvalid resource url ref invalid_reference in policy policy_name in org_name\n```\n\n### Example error message\n\n```python\nError Deploying Revision 2 to prod\nInvalid resource url ref py://myscript.py in policy Python_script in myorg\n```\n\n### Example screenshot\n\n### Cause\n\nIf the `\u003cResourceURL\u003e` and `\u003cIncludeURL\u003e` elements refer to a PythonScript file\nthat does not exist, then the deployment of the API proxy fails.\nIf you are deploying a proxy bundle from your local machine, then the PythonScript\nsource files must be stored under `/apiproxy/resources/py`(at the API proxy scope).\n\nIn the Apigee UI, the PythonScript source files appear under **py** in the Scripts section\nof the API proxy editor's Navigator pane as shown below:\n\nYou can also store resource files in [environment level repositories](/apigee/docs/api-platform/develop/resource-files) (to make PythonScript code available to all proxies in an env, for example). If any resource files specified in the policy cannot be found, then this error occurs.\n\n### Diagnosis\n\n1. Identify the PythonScript policy where the error occurred and the invalid resource URL reference. You can find this information from the error message. For example, in the following error, the policy name is `Python_script` and the invalid resource URL reference is `py://myscript.py`:\n\n ```python\n Invalid resource url ref py://myscript.py in policy Python_script in myorg\n ```\n2. Verify that the resource URL reference specified in the failed PythonScript policy matches with the value identified in the error message (step #1 above). For example, the following policy specifies the resource URL reference as `py://myscript.py`, which matches what's in the error message:\n\n ```python\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cScript async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Python_script\"\u003e\n \u003cDisplayName\u003ePython-1\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cResourceURL\u003epy://myscript.py\u003c/ResourceURL\u003e\n \u003c/Script\u003e\n ```\n3. Check if the file identified in step #1 file is part of the specific API Proxy bundle, or exists at the environment scope.\n\n 1. To check if the file is part of the specific API Proxy bundle, follow one of the below steps:\n 1. In the Apigee UI, check if this file is in the Scripts section of the API proxy.\n 2. Download the API Proxy bundle and search if the file exists.\n 2. If the file is not part of the specific API Proxy bundle, then check if it exists at the environment level. You can use the [Resource Files API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.resourcefiles) for this investigation.\n\n If the file does not exist at the API Proxy or environment level, then that's the cause of the error.\n\n In the example above, the invalid PythonScript filename is myscript.py. In the screenshot below, notice that the file specified as a resource URL in the policy does not appear in the Scripts section. Also the file does not exist at the environment level. Therefore, the deployment of the API Proxy fails with the error: \n\n ```python\n Invalid resource url ref py://myscript.py in policy Python_script in myorg\n ```\n\n### Resolution\n\nEnsure that the PythonScript files specified in `\u003cResourceURL\u003e` and `\u003cIncludeURL\u003e` elements refer to a valid file that exists at the API Proxy or environment level.\n\nTo correct the example PythonScript policy shown above, add the file myscript.py to the API Proxy bundle. In the screenshot below you can see that the PythonScript files specified in `\u003cResourceURL\u003e` and `\u003cIncludeURL\u003e` elements are visible in the Scripts section of the API Proxy bundle:"]]