ampproject / ampproject/amphtml

Local server port not set correctly for frame.max.html when debugging with Chrome plugin

Open
#40,250 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I'm using the amp built-in Chrome plugin to test local amp sources (testing an ads provider) on a live site with the following settings:

![Image](https://github.com/user-attachments/assets/b1dba541-9e54-41c8-a93f-93e68ab89c99)

and get the following error in the network:

![Image](https://github.com/user-attachments/assets/e4c86194-5aec-40cb-9adb-df42b143fa38)

That is caused by the incorrect src generated for the frame:
incorrect: `http://ads.localhost/dist.3p/current/frame.max.html`
instead of:
correct: `http://ads.localhost:8000/dist.3p/current/frame.max.html` (mind the port)

I've back traced the error to the following line, where it seems like the port is not set correctly:
https://github.com/ampproject/amphtml/blob/190a7ea1a7d7f5de2dda45dda1f738b00967d54e/src/3p-frame.js#L299

If I manually set the correct src for the frame inside the `amp-ad-0.1.js` (via local overrides)

![Image](https://github.com/user-attachments/assets/2acae480-e569-4227-9383-a22686f43335)

Everything starts working fine.

In the sources that`s the place: https://github.com/ampproject/amphtml/blob/42c3b1de1ad3474ed47b047208fb1bb3f570dbcc/extensions/amp-ad/0.1/amp-ad-xorigin-iframe-handler.js#L289

Other sources are correclty handled by the plugin and served from the correct domain:port:

![Image](https://github.com/user-attachments/assets/8168cd79-bddd-4bd8-96db-e7c092ee8fd9)

Is this an issue or am I missing smth?

Contributor guide

Open the contributing guide

Research direction

Reproduce the local AMP setup with the built-in Chrome plugin and inspect src/3p-frame.js around line 299 and extensions/amp-ad/0.1/amp-ad-xorigin-iframe-handler.js around line 289. Compare the generated frame.max.html URL with the correctly handled sources. Done means the frame URL preserves the local server port, such as :8000, when debugging local AMP sources.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.