Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while parsing APIv2 #132

Closed
TomOne opened this issue Dec 5, 2023 · 2 comments · Fixed by #133
Closed

Error while parsing APIv2 #132

TomOne opened this issue Dec 5, 2023 · 2 comments · Fixed by #133
Labels
bug Something isn't working

Comments

@TomOne
Copy link

TomOne commented Dec 5, 2023

Describe the bug

Attempting to parse APIv2 throws the following error:

ERROR Cannot convert undefined or null to object
at Function.keys ()
at processCSS (src/api-parser-v2.ts:206:29)
at processQueue (src/api-parser-v2.ts:238:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at (src/api-parser-v2.ts:263:5)
at (node_modules/.pnpm/[email protected]/node_modules/p-queue/dist/index.js:118:36)

node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

TypeError: Cannot convert undefined or null to object
at Function.keys ()
at processCSS (/home/user/Code/google-font-metadata/src/api-parser-v2.ts:206:29)
at processQueue (/home/user/Code/google-font-metadata/src/api-parser-v2.ts:238:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at (/home/user/Code/google-font-metadata/src/api-parser-v2.ts:263:5)
at (/home/user/Code/google-font-metadata/node_modules/.pnpm/[email protected]/node_modules/p-queue/dist/index.js:118:36)

Node.js v20.10.0

It looks like the newly added typeface Linefont (added on 2023-10-25) is the culprit.

Steps to Reproduce

Run npm run gfm parse --v2

Expected behavior

No response

Version

5.2.0

OS

Linux

Browser

No response

Additional context

No response

@TomOne TomOne added the bug Something isn't working label Dec 5, 2023
@ayuhito
Copy link
Member

ayuhito commented Dec 5, 2023

Looks like the Google Fonts team has explicitly decided to not support Linefont as a static font. google/fonts#4630 (comment)

It's a little bit annoying since we have no indication from the APIs we are dependent on if they would do something like this again for another font. Nor do I think it's a sustainable idea to let our build pipelines hard throw if something like this happens again.

I think I'll switch this error to a warning in logs instead of throwing, and also explicitly add a blocklist of fonts that should ignore generating data for static fonts. That's going to break some assumptions made downstream in the Fontsource API as it assumes the existence of static metadata to serve variable metadata, so it may be considered a breaking change for this library... but older versions just won't work anyways with this upstream change so it will just be a patch bump.

@ayuhito
Copy link
Member

ayuhito commented Dec 5, 2023

New release should be published to NPM now. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants