# AUR0722

### **Error message**

Invalid platform object provided to the compilation, no DOM API found.

### **Parameters**

None

### Error explanation

This error occurs during the template compilation setup when the compiler cannot access a valid Document Object Model (DOM) API through the provided platform object. The template compiler requires access to standard DOM features (like `document`, `createElement`, etc.) to parse and process HTML templates. This error indicates that the environment where the compilation is happening is missing these essential DOM APIs or that the platform abstraction used by Aurelia was not correctly initialized with them.

### Common causes

* Running the template compiler in a non-browser environment (e.g., Node.js) without providing a DOM implementation (like `jsdom`).
* Incorrectly configuring or initializing the Aurelia `IPlatform` service in a custom setup.
* An issue with the environment's global `document` object if running in a browser-like context.

### How to fix

* **Browser Environment:** Ensure you are running the application in a standard browser environment where `window.document` is available.
* **Node.js/SSR Environment:** If compiling templates outside a browser, ensure a DOM implementation (like `jsdom`) is correctly configured and provided to Aurelia's platform abstraction before compilation occurs. Refer to Aurelia's Server-Side Rendering (SSR) documentation for guidance.
* **Custom Platform:** If using a custom `IPlatform` implementation, verify that it correctly provides access to a functional DOM API, including a `document` object with standard properties and methods.

### Debugging tips

* Verify the execution environment (browser vs. non-browser).
* If in Node.js, check your DOM simulation setup (e.g., `jsdom` initialization).
* Inspect the `IPlatform` service registered in the DI container to ensure it holds a valid DOM reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aurelia.io/developer-guides/error-messages/0088-to-0723/aur0722.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
