I try to build firefox with specifying a bing API key (ac_add_options --with-bing-api-keyfile=</path/to/keyfile>
in the .mozconfig
). However, when configuration runs, I get the error ERROR: Bing API key file has an invalid format.
I provided the API within the file </path/to/keyfile>
as a string of 64 characters (with or without a trailing newline, both does not work).
1 Answer
The answer is:
The username to which the API key belongs needs to be prepended, separated by whitespace. So the format should be
<https://www.bingmapsportal.com/-Username> <API key>
Looking at the python script that checks the firefox-build-configuration suggests that there is some information like an ID needed:
[...]
with MockedOpen({'key': 'fake-id fake-key\n'}):
config, output, status = self.get_result(
"id_and_secret_keyfile('Bing API')",
args=['--with-bing-api-keyfile=key'],
includes=includes)
self.assertEqual(status, 0)
self.assertEqual(output, textwrap.dedent('''\
checking for the Bing API key... yes
'''))
self.assertEqual(config, {
'MOZ_BING_API_CLIENTID': 'fake-id',
'MOZ_BING_API_KEY': 'fake-key',
})
with MockedOpen({'key': 'fake-key\n'}):
config, output, status = self.get_result(
"id_and_secret_keyfile('Bing API')",
args=['--with-bing-api-keyfile=key'],
includes=includes)
self.assertEqual(status, 1)
self.assertEqual(output, textwrap.dedent('''\
checking for the Bing API key... no
ERROR: Bing API key file has an invalid format.
'''))
self.assertEqual(config, {})
[...]