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

Safari Bug: Invalid regular expression: invalid group specifier name #8

Closed
iduuck opened this issue Dec 13, 2022 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@iduuck
Copy link
Collaborator

iduuck commented Dec 13, 2022

Hello, I got an error on safari browsers (including mobile safari) and I nailed it down to the creation of the safe query runner.

I am seeing the following error:

SyntaxError: Invalid regular expression: invalid group specifier name
@gksander gksander added the bug Something isn't working label Dec 13, 2022
@gksander
Copy link
Contributor

Thanks for reporting, I'll take a peak. Interestingly, the makeSafeQueryRunner looks like this:

export const makeSafeQueryRunner =
  (fn: QueryExecutor) =>
  <T extends BaseType>({
    query,
    schema,
  }: QueryResult<T>): Promise<z.infer<T>> =>
    fn(query).then((res) => schema.parse(res));

There aren't any regular expressions involved, and it's a pretty simple implementation. I'll peak a little bit deeper to see if I can diagnose what's going on!

@iduuck
Copy link
Collaborator Author

iduuck commented Dec 14, 2022

Yeah, I already checked the source code, and saw that the lib didn't feature any regular expression. I immediately noticed, that zod is using some regular expressions under the hood, but don't know, why the makeSafeQueryRunner import is breaking Safari.

Edit: If it helps, here is the stack trace (so there is something about zod):
CleanShot 2022-12-14 at 12 51 20@2x

@iduuck
Copy link
Collaborator Author

iduuck commented Dec 14, 2022

Just saw those 2 issues/prs on the zod repo: colinhacks/zod#1668 colinhacks/zod#1683

Seems like groqd needs to update to a reverted version: 3.20.2

iduuck added a commit to iduuck/groqd that referenced this issue Dec 14, 2022
@gksander
Copy link
Contributor

Closed via #9, released as 0.1.2. Thanks @iduuck for catching this and putting together a resolution!

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

No branches or pull requests

2 participants