ข้อความแสดงข้อผิดพลาด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้อธิบายข้อความแสดงข้อผิดพลาดที่ Embed API ของ Maps อาจแสดง เมื่อเกิดข้อผิดพลาดขึ้น Embed API ของ Maps จะแสดงข้อความแสดงข้อผิดพลาดแทนแผนที่
นอกจากนี้ ยังอาจเกิดข้อผิดพลาดบางอย่างขึ้น ซึ่งส่งผลให้แผนที่ที่มีลายน้ำปรากฏขึ้นแบบสลัว
คำขอที่ไม่ถูกต้อง
ในกรณีที่คำขอไม่ถูกต้อง Maps Embed API จะแสดงรหัสสถานะ HTTP 4xx
และข้อความที่อธิบายปัญหา ตัวอย่างเงื่อนไขข้อผิดพลาดมีดังนี้ หมายเหตุ: รายการนี้เป็นเพียงตัวอย่างข้อผิดพลาดที่อาจเกิดขึ้น ตรวจสอบรหัสข้อผิดพลาดจริงและข้อความที่ API แสดงเพื่อดูรายละเอียดของปัญหาที่เฉพาะเจาะจง
ตัวอย่างเงื่อนไขข้อผิดพลาด |
รหัสสถานะ |
คำขอมีพารามิเตอร์ที่ไม่ถูกต้อง หรือไม่มีพารามิเตอร์ที่จำเป็น เช่น พารามิเตอร์ zoom ไม่ได้อยู่ในช่วงค่าตัวเลขที่คาดไว้ หรือคําขอไม่มีพารามิเตอร์ที่จําเป็น |
400 BAD REQUEST |
คีย์ API ที่รวมอยู่ในคําขอไม่ถูกต้อง |
403 FORBIDDEN |
ข้อผิดพลาดเกี่ยวกับคีย์ API และโควต้า
ระบบจะถือว่าข้อผิดพลาดเกี่ยวกับคีย์ API และโควต้าเป็นคำขอที่ไม่ถูกต้อง สาเหตุที่เป็นไปได้มีดังนี้
ข้อผิดพลาดเกี่ยวกับการเรียกเก็บเงินและข้อมูลอ้างอิง HTTP
ระบบจะแสดงแผนที่ที่มืดลงหรือรูปภาพ Street View "เชิงลบ" ที่มีลายน้ำ"สำหรับการพัฒนาเท่านั้น" เมื่อเงื่อนไขต่อไปนี้เป็นจริง
ตรวจสอบข้อผิดพลาดในเบราว์เซอร์
สําหรับข้อผิดพลาดเกี่ยวกับการเรียกเก็บเงินและผู้อ้างอิง HTTP Embed API ของ Maps จะเขียนข้อความแสดงข้อผิดพลาดไปยัง window.console
สําหรับคําขอที่ไม่ถูกต้อง (รวมถึงข้อผิดพลาดเกี่ยวกับคีย์ API และโควต้า) ระบบจะรายงานเฉพาะรหัสสถานะ HTTP 4xx
ในคอนโซล ส่วนนี้จะอธิบายวิธีตรวจสอบเอาต์พุตคอนโซลใน Google Chrome หากคุณใช้เบราว์เซอร์อื่น โปรดดูเอกสารประกอบสำหรับนักพัฒนาซอฟต์แวร์ของเบราว์เซอร์นั้นๆ ต่อไปนี้เป็นรายการเครื่องมือสำหรับตรวจสอบเอาต์พุตคอนโซลในเบราว์เซอร์อื่นๆ
ใน Chrome คุณสามารถใช้คอนโซล JavaScript เพื่อตรวจสอบเอาต์พุตคอนโซลได้ ดังนี้
-
หากต้องการเปิดเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์ ให้เลือกไอคอนเมนู > เครื่องมือเพิ่มเติม >
เครื่องมือสำหรับนักพัฒนาซอฟต์แวร์
-
หากต้องการเปิดคอนโซล JavaScript ให้คลิกแท็บคอนโซลที่ด้านบนของหน้าต่างเครื่องมือสําหรับนักพัฒนาซอฟต์แวร์ คุณใช้แป้น ESC เพื่อเปิด/ปิดคอนโซล JavaScript ได้ด้วย
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThe Maps Embed API displays error messages in place of the map or as a darkened, watermarked map when errors occur.\u003c/p\u003e\n"],["\u003cp\u003eInvalid requests result in a \u003ccode\u003e4xx\u003c/code\u003e HTTP status code and a descriptive error message, often due to missing or incorrect parameters or an invalid API key.\u003c/p\u003e\n"],["\u003cp\u003eAPI key and quota errors are treated as invalid requests, and can stem from a missing, invalid, or restricted API key, or a disabled API.\u003c/p\u003e\n"],["\u003cp\u003eBilling and HTTP referer errors result in a darkened, watermarked map, and may be caused by billing issues, exceeding usage limits, or missing HTTP referers.\u003c/p\u003e\n"],["\u003cp\u003eError messages for billing and referer issues can be found in the browser's console; invalid request errors show only the HTTP status code.\u003c/p\u003e\n"]]],["The Maps Embed API displays error messages or a watermarked map when issues occur. Invalid requests trigger a `4xx` status code, indicating problems like missing or incorrect parameters or an invalid API key. Billing or HTTP referer issues result in a watermarked map, caused by disabled billing, invalid payment, exceeded limits, or missing referers. Errors are logged in the browser's console (`window.console`) and can be checked via browser developer tools.\n"],null,["This page describes the error messages that can be returned by the\nMaps Embed API. When an error occurs, the\nMaps Embed API presents error message text in place of the map.\nCertain error conditions may also occur, which result in the display of a\ndarkened watermarked map.\n\nInvalid requests\n\nIn the case of an invalid request, the Maps Embed API returns\nan HTTP `4xx` status code and a message describing the\nproblem. Below are examples of error conditions. Note: This is not\na complete list of the possible errors. Check the actual error code\nand message returned by the API for details of specific problems.\n\n| Example of error condition | Status code |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| The request includes an invalid parameter, or a required parameter is missing. For example, the `zoom` parameter is not within the expected range of numeric values, or a required parameter is missing from the request. | `400 BAD REQUEST` |\n| The API key included in the request is invalid. | `403 FORBIDDEN` |\n\nAPI key and quota errors\n\nAPI key and quota errors are treated as invalid requests. Possible causes\ninclude the following:\n\n- Missing or invalid API key. To resolve this error, ensure that your request includes a valid API key. [Get an API key](/maps/documentation/embed/get-api-key#get-an-api-key).\n- Maps Embed API is not enabled for your project. Learn about [enabling and disabling APIs](https://cloud.google.com/apis/docs/enable-disable-apis).\n- API key has a restriction violation. [Read\n more about API key best practices](/maps/api-key-best-practices).\n\nBilling and HTTP referer errors\n\nA darkened map, or \"negative\" Street View image, watermarked with \"for\ndevelopment purposes only\" is returned when any of the following is true:\n\n- Billing has not been enabled on your account. [Enable billing](https://console.cloud.google.com/project/_/billing/enable?utm_source=Docs_BillingNudge).\n- The provided billing method is invalid (for example an expired credit card). To resolve this, visit the [Google Cloud console, and ensure that you have provided a valid method of payment.](https://console.cloud.google.com/project/_/billing)\n- A self-imposed daily limit has been exceeded. [Learn how to view or change daily billable limits](/maps/documentation/embed/usage-and-billing#set-caps).\n- The request is missing an HTTP referer, and you are using a referer-restricted API key. [Learn\n more about adding referers](/maps/api-key-best-practices).\n\nCheck errors in your browser\n\nFor Billing and HTTP referer errors, the Maps Embed API writes\nerror messages to `window.console`. For invalid requests (including\nAPI key and quota errors), only the HTTP `4xx` status code is reported\nin the console. This section explains how you can check the console output in\nGoogle Chrome. If you are using any other browsers, please check the developer\ndocumentation for your browser. For your reference, this is a list of tools to\ncheck console output in some other browsers.\n\n- [Console](https://msdn.microsoft.com/en-us/library/dn255006(v=vs.85).aspx) for Internet Explorer.\n- [Web Console](https://developer.mozilla.org/en-US/docs/Tools/Web_Console) for Firefox.\n- [Remote debugging](https://developer.chrome.com/devtools/docs/remote-debugging) for Android.\n- [Web Inspector](https://developer.apple.com/library/safari/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html) for iOS.\n\n\nIn Chrome, you can use the\n[JavaScript Console](/web/tools/chrome-devtools/debug/console)\nto check console output as follows.\n\n1. To open the Developer Tools, select the menu icon \\\u003e **More Tools** \\\u003e **Developer Tools**.\n2. To open the JavaScript Console, click the **Console** tab at the top of the Developer Tools window. You can also use the ESC key to toggle the JavaScript Console."]]