You will see this message in Generate Embed when reviewing the interface for any user.
As of February 21st, 2024, google.maps.Marker is deprecated.
Please use google.maps.marker.AdvancedMarkerElement instead.
At this time, google.maps.Marker is not scheduled to be discontinued, but google.maps.marker.AdvancedMarkerElement is recommended over google.maps.Marker.
While google.maps.Marker will continue to receive bug fixes for any major regressions, existing bugs in google.maps.Marker will not be addressed.
At least 12 months notice will be given before support is discontinued.
Please see https://developers.google.com/maps/deprecations for additional details and https://developers.google.com/maps/documentation/javascript/advanced-markers/migration for the migration guide.
__
Failed testing: Apr 5 2026
TypeError: undefined is not an object (evaluating ‘new google.maps.marker.AdvancedMarkerElement’)
Resolution
Resolution provided by JetBrains AI Assistant running their Codex interface (OpenAI) with a full access Agent.
Model: gpt-5.3-codex (high)
Summary: ai-handoff-2026-03-03-1739.md
Topic Summary
This session migrated Store Locator Plus/Premier/Power Google Maps marker usage from deprecated google.maps.Marker to google.maps.marker.AdvancedMarkerElement across admin and front-end paths, then resolved runtime regressions caused by map ID requirements and legacy clustering assumptions. Follow-up fixes addressed stack recursion in marker compatibility shims and markerclusterer.js failures with non-function lat/lng values.
Testing Notes
Aug 5 2025 : v2603.24.01 : Failed
https://qc.storelocatorplus.com/mybeta/freshy-stage/
On Safari:
Develop / Show JavaScript Console
__
[Warning] Google Maps JavaScript API: A Map’s styles property cannot be set when a mapId is present. When a mapId is present, map styles are controlled via the cloud console. Please see documentation at https://developers.google.com/maps/documentation/javascript/styling#cloud_tooling (js, line 496)
__
[Error] TypeError: undefined is not an object (evaluating ‘new google.maps.marker.AdvancedMarkerElement’)
(anonymous function) (Anonymous Script 1 (line 1:14145))
slp_Marker (Anonymous Script 1 (line 1:14614))
(anonymous function) (Anonymous Script 1 (line 1:19262))
(anonymous function) (Anonymous Script 1 (line 1:18068))
(anonymous function) (Anonymous Script 1 (line 160))
Dev Notes
google.maps.Marker in the Maps JavaScript API (Deprecated as of February 2024)
Advanced Markers (google.maps.marker.AdvancedMarkerElement) are better than google.maps.Marker in almost every way: easier to use, more performant, more accessible, more feature-rich, and more customizable. google.maps.Marker in the Maps JavaScript API is deprecated as of 3.56.
What do I need to do? Instead, use google.maps.marker.AdvancedMarkerElement. The minimum version of the Maps JavaScript API with google.maps.marker.AdvancedMarkerElement is 3.53.2.
At this time, google.maps.Marker is not scheduled to be discontinued, but google.maps.marker.AdvancedMarkerElement is recommended over google.maps.Marker. While google.maps.Marker will continue to receive bug fixes for any major regressions, existing bugs in google.maps.Marker won’t be addressed. At least 12 months notice will be given before support is discontinued.
google.maps.marker
google.maps.Marker is the following plug-ins power, premier, store locator plus

Google Maps Library Loading
\SLPlus::get_google_maps_url
This sets the map URL.
If your web page uses the legacy direct script loading tag, add libraries=marker to the loading script, as shown in the following snippet.
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap&v=weekly&libraries=marker"
defer
></script>
This is changed in SLP v2603.03.01 to this URL:
$google_api_url = 'https://maps.googleapis.com/maps/api/js?libraries=geometry,marker&v=quarterly&';
Migration Tips
Before Migration Example:
// The location of Uluru
const position = { lat: -25.344, lng: 131.031 };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: position,
});
// The marker, positioned at Uluru
const marker = new google.maps.Marker({
map: map,
position: position,
title: 'Uluru',
});
After Migration Example:
// Import the needed libraries.
// Not required if the legacy direct script loading tag is in use.
await google.maps.importLibrary('maps') as google.maps.MapsLibrary;
await google.maps.importLibrary('marker') as google.maps.MarkerLibrary;
// The location of Uluru
const position = { lat: -25.344, lng: 131.031 };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: position,
mapId: "DEMO_MAP_ID", // Map ID is required for advanced markers.
});
// The advanced marker, positioned at Uluru
const marker = new google.maps.marker.AdvancedMarkerElement({
map,
position: position,
title: 'Uluru/Ayers Rock',
});
E2E Testing
- Login as Enterprise user (enterprise@storelocatorplus.com)
- Click Location Details in the sidebar menu
- If location count is < 1
- Add locations via
- Click Generate Embed in sidebar menu
- Ensure there are not JavaScript Errors
- TypeError is an unacceptable error, fail the test.
AI Summary
In this session, we migrated Google Maps marker usage across Store Locator Plus, Premier, and Power JavaScript files from deprecated google.maps.Marker to google.maps.marker.AdvancedMarkerElement. We updated marker creation in core, admin, and add-on scripts, added compatibility methods so existing code paths continue to work, and updated map initialization so a valid mapId is always provided (with configured-option lookups and fallback support). We also updated info-window anchoring for Advanced Markers and bumped JavaScript headstone versions where files were changed.
After rollout testing, we fixed two runtime regressions: a stack overflow caused by overwriting native setMap() in the compatibility shim, and a clustering error (p2.lat is not a function) caused by legacy MarkerClusterer assumptions about LatLng method signatures. We patched the legacy markerclusterer.js to accept both LatLng objects and lat/lng literals, hardened position normalization in slp_core.js, and regenerated minified assets (slp_core.min.js and markerclusterer.min.js) so production and non-debug WordPress environments use the same corrected logic.
April 2026 Patch Summary
# Topic Summary
This session fixed a Google Maps Advanced Marker runtime regression without reintroducing deprecated `google.maps.Marker` usage. It also captured project rules around Cypress testing, deprecated APIs, and `uglifyjs` invocation, then started revision bumps for `slp-power`, `slp-premier`, and `store-locator-plus`.
# Topic Details
The core bug was a JavaScript runtime failure when map rendering reached `new google.maps.marker.AdvancedMarkerElement(...)` before the marker library was actually available. Prior notes had already added `libraries=marker` to the Google Maps URL, but the runtime still assumed the `marker` namespace was synchronously ready. The final fix kept the modern Advanced Marker path and added explicit `google.maps.importLibrary("marker")` gating before marker creation on the shared frontend map runtime and the related admin/add-on marker entry points.
Validation used the existing Cypress project at `SLP_SaaS/Testing/myslp-cypress`, not Playwright. The relevant spec `cypress/e2e/generate_embed_enterprise_errors.cy.js` ran against `https://local.storelocatorplus.com:443`. The old `AdvancedMarkerElement` TypeError no longer appeared; the remaining failing assertions were unrelated pre-existing React console warnings from `slp_info_react`. In parallel, AGENTS rules were updated to prefer Cypress for browser testing, avoid deprecated APIs, and avoid the broken `uglifyjs --comments` regex pattern in this environment.
# Results
- Fixed async marker-library readiness in:
- `WordPress/wp-content/plugins/store-locator-plus/js/slp_core.js`
- `WordPress/wp-content/plugins/store-locator-plus/js/admin-locations-tab.js`
- `WordPress/wp-content/plugins/slp-power/js/slp-power_userinterface.js`
- `WordPress/wp-content/plugins/slp-premier/js/admin.js`
- `WordPress/wp-content/plugins/slp-premier/js/admin-locations-tab.js`
- `WordPress/wp-content/plugins/slp-premier/js/admin-settings-tab.js`
- Rebuilt matching minified assets and `.map` files with `uglifyjs --compress --mangle --source-map ...`.
- Verified edited source and minified files with `node --check`.
- Ran Cypress:
- command: `yarn cy:run:local --spec cypress/e2e/generate_embed_enterprise_errors.cy.js`
- repo: `SLP_SaaS/Testing/myslp-cypress`
- outcome: no observed `AdvancedMarkerElement` TypeError; spec failed on unrelated React console warnings in `slp_info_react`.
- Updated `AGENTS.md` with:
- Cypress-over-Playwright testing rule
- no deprecated API fallback rule
- `uglifyjs` comment-regex failure note
- Started revision bumps only, no commits yet:
- `WordPress/wp-content/plugins/slp-power`: `2603.03.01 -> 2604.06.01`
- `WordPress/wp-content/plugins/slp-premier`: `2603.05.01 -> 2604.06.01`
- `WordPress/wp-content/plugins/store-locator-plus`: `2604.05.01 -> 2604.06.01`
- Repos left with user confirmation pending before commit.
# AI Handoff
- `project_scope`
- Fix Advanced Marker runtime bug on local/staging map flows without using deprecated Google Maps marker APIs.
- Preserve existing WordPress enqueue model and legacy compatibility shims.
- Start revision versions for three plugin repos without committing.
- `repo_map`
- Core/frontend runtime: `WordPress/wp-content/plugins/store-locator-plus/js/slp_core.js`
- Core admin map helper: `WordPress/wp-content/plugins/store-locator-plus/js/admin-locations-tab.js`
- Power inline map: `WordPress/wp-content/plugins/slp-power/js/slp-power_userinterface.js`
- Premier admin maps: `WordPress/wp-content/plugins/slp-premier/js/admin.js`, `admin-locations-tab.js`, `admin-settings-tab.js`
- Cypress repo: `SLP_SaaS/Testing/myslp-cypress`
- Rules file updated: `AGENTS.md`
- `architecture`
- `slp_Map` + `slp_Marker` in `slp_core.js` remain central map abstractions.
- Google loader already included `libraries=geometry,marker`; missing piece was runtime readiness of `google.maps.marker`.
- Final model = `ensure_marker_library()` / `importLibrary("marker")` before any `AdvancedMarkerElement` construction.
- Admin/add-on marker factories now stay on Advanced Markers and do not fall back to deprecated `google.maps.Marker`.
- `key_components`
- `slp.ensure_marker_library()` caches `google.maps.importLibrary("marker")`.
- `slp_Map.build_map()` now waits for marker library readiness before constructing map flows that immediately add markers.
- Geocode fallback paths wrap `build_map()` in `Promise.resolve(...)`.
- Store Locator Plus admin location map waits for marker library before publishing `location_map_initialized`.
- Power and Premier admin paths now gate their marker creation with local `*_ensure_marker_library()` helpers.
- `important_nuances`
- Do not use `google.maps.Marker` as a fallback; user explicitly rejected any deprecated-path workaround.
- `libraries=marker` in the script URL was already present in `SLPlus.php`; bug source was async/runtime availability, not just URL construction.
- Cypress spec failure is noisy because it captures all console errors; current remaining failures are in React bundle `slp_info_react`, not the map marker code.
- `uglifyjs` comment preservation regex `--comments '/^!|@preserve|@license|@cc_on|^\\/**/'` fails in this environment with `Invalid regular expression ... Nothing to repeat`.
- For browser testing here, use Cypress at `SLP_SaaS/Testing/myslp-cypress`; do not default to Playwright.
- `decisions_and_rationale`
- Decision: keep Advanced Marker migration and repair library import timing.
- Rationale: matches Google’s modern API path and user direction.
- Decision: implement marker-library guards in each active marker entry point rather than only in PHP.
- Rationale: protects async admin/add-on runtime paths immediately.
- Rejected: deprecated `google.maps.Marker` fallback.
- Rationale: user explicitly rejected it and it reintroduces deprecation warnings.
- Decision: use existing Cypress spec for Generate Embed JS errors.
- Rationale: project-standard test harness and closest existing coverage.
- `state_of_work`
- Completed:
- Advanced Marker async import fix across core, Premier, and Power JS.
- Rebuilt minified assets.
- Updated AGENTS rules.
- Ran Cypress validation.
- Started revision bumps for `slp-power`, `slp-premier`, `store-locator-plus`.
- Pending:
- No commits for any start-revision requests; all three are awaiting user confirmation.
- React console warnings in `slp_info_react` remain and still fail the Cypress spec.
- `open_items`
- Decide whether to narrow Cypress assertions to marker-specific errors or fix the unrelated React warnings.
- User confirmation required before committing:
- `slp-power` revision `2604.06.01`
- `slp-premier` revision `2604.06.01`
- `store-locator-plus` revision `2604.06.01`
- If desired, inspect `slp_info_react` bundle/source for:
- invalid `loading` boolean prop handling
- missing React list `key`
- `ReactDOM.render` on React 18
- `next_actions`
- If user confirms, commit each plugin repo with `Start version 2604.06.01`.
- If map regression validation needs tightening, add or adjust Cypress coverage to assert absence of `AdvancedMarkerElement` TypeError specifically.
- If broader JS-clean run is needed, fix `slp_info_react` console warnings so `generate_embed_enterprise_errors.cy.js` can pass cleanly.