1

I'm getting ERROR: could not unmarshal event: unknown PrivateNetworkRequestPolicy value while fetching amazon using chromedp. Tried with different user-agents but nothing works.

github.com/chromedp/cdproto v0.0.0-20220816211547-b8b15824df23 github.com/chromedp/chromedp v0.8.4 Google Chrome 104.0.5112.79

Jff
  • 91
  • 1
  • 8

2 Answers2

0

What is wrong

Google Chrome 104.0.5112.79 has such policies (see browser_protocol.pdl#L6178-L6184):

  • Allow
  • BlockFromInsecureToMorePrivate
  • WarnFromInsecureToMorePrivate
  • PreflightBlock
  • PreflightWarn

And github.com/chromedp/cdproto v0.0.0-20220816211547-b8b15824df23 supports the same list of polices (see cdproto).

So the error looks impossible.

What to do next

The last change to PrivateNetworkRequestPolicy is 97.0.4665.1_9.7.3 which adds two new values:

  • PreflightBlock
  • PreflightWarn

Please double check the version of the chromedp/cdproto package and the version of the browser.

Now that Chrome 105 has been released, please upgrade to this version. Maybe it will address the issue.

It will be helpful if you can enable the debug log to record what is the invalid value. Enable the debug log like this:

ctx, cancel := chromedp.NewContext(ctx, chromedp.WithDebugf(log.Printf))
Zeke Lu
  • 6,349
  • 1
  • 17
  • 23
0

updating chromedp to the latest version fixed the issue.

Refer: https://github.com/chromedp/chromedp/issues/797

go list -m github.com/chromedp/cdproto

github.com/chromedp/cdproto v0.0.0-20221126224343-3a0787b8dd28
Jff
  • 91
  • 1
  • 8