We have been running some code to produce animated charts with a background image. That was working, but yesterday the same code started producing CORS errors.
Striping down the code to try to provide a minimal example, the problem seems to lie with export png. I am not sure this is related to the CORS error, but when I try this code with bokeh serve, the chart with background appears in the browser, but the png shows just the line, and no background.
import pandas as pd
from bokeh.models import ColumnDataSource, Range1d, Span, NumeralTickFormatter, ImageURL
from bokeh.io import curdoc, export_png
from bokeh.plotting import figure
from bokeh.layouts import column
import numpy as np
from bokeh.themes import Theme
theme_path = "theme.yml"
dates = pd.date_range("20210101", periods=6)
df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list("ABCD"))
df.rename_axis('Date', axis=0, inplace=True)
source = ColumnDataSource(df)
url = 'https://www.eastasiaecon.com/content/images/size/w2400/2023/04/Image-29-4-2023-at-7.34-PM.jpeg'
p = figure(aspect_ratio=16/9,
x_range=Range1d(start=dates[0], end=dates[-1]), x_axis_type='datetime')
p.extra_y_ranges = {"secondary": Range1d(start=0, end=1)}
p.image_url(url=[url], x=dates[0], y=0, w=dates[-1] - dates[0], h=1, anchor="bottom_left", alpha=0.2, level='underlay', y_range_name="secondary")
p.line(x='Date', y='A', source=source, color='green', level='overlay')
export_png(p, filename=f"test.png",width=p.width, height=p.height)
layout = column(p)
curdoc().add_root(layout)
curdoc().theme = Theme(filename=theme_path)