# AUR1005

## Error Message

Development builds:

`AUR1005: The PLATFORM did not receive a valid reference to the global function '<name>'.`

Production builds:

`AUR1005:<name>`

Where `<name>` is the missing global function name (for example `queueMicrotask` or `performance.now`).

## Description

This error is thrown by `@aurelia/platform` when a platform API is requested (for example `platform.queueMicrotask(...)`) but the `Platform` instance was created without a usable reference to the underlying global function.

This typically happens when:

* You run Aurelia in an environment that does not provide the expected global (older JS runtimes, unusual embedded runtimes, some test environments).
* The global exists but is not a function, or cannot be bound (for example due to a mocked global).
* You are using `Platform.getOrCreate(globalThis, overrides)` but the required function is missing and you did not provide an override.

## Example Trigger

```ts
import { Platform } from '@aurelia/platform';

// ❌ A mocked global without queueMicrotask
const g = { console } as unknown as typeof globalThis;
const platform = Platform.getOrCreate(g);

// Throws AUR1005 when invoked
platform.queueMicrotask(() => {});
```

## Correct Usage

* Use a runtime that provides the required globals (recommended).
* If you must run in a constrained environment, provide a polyfill or an override when creating the `Platform`.

```ts
import { Platform } from '@aurelia/platform';

const platform = Platform.getOrCreate(globalThis, {
  queueMicrotask: (cb) => Promise.resolve().then(cb),
  performanceNow: () => Date.now(),
});
```

## Troubleshooting

* Inspect the `<name>` parameter in the error to see which global is missing.
* Verify your runtime/test environment provides that API on `globalThis` (or `window` in browsers).
* If you are mocking globals, ensure you return actual functions (and don’t remove/break bindings).
* Add a targeted polyfill/override for the missing API.


---

# 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/platform/aur1005.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.
