# 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.
