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

[bug]: NodeJs - Property 'replaceAll' does not exist on type 'string'. #1559

Closed
risalfajar opened this issue Oct 4, 2024 · 7 comments · Fixed by algolia/api-clients-automation#3897
Labels

Comments

@risalfajar
Copy link

Description

I want to use Algolia library in my Firebase Cloud Functions project, but when I'm trying to deploy a function, it throws an error:

node_modules/@algolia/client-common/src/transporter/helpers.ts:42:11 - error TS2550: Property 'replaceAll' does not exist on type 'string'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.

So I add this to my tsconfig:

{
    "compilerOptions": {
        "lib": [
          "ES2021.String"
        ]
    }
}

But then the error changed:

node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts:10:41 - error TS2304: Cannot find name 'window'.

Client

Search

Version

5.7.0

Relevant log output

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc && tsc-alias

node_modules/@algolia/client-common/src/transporter/helpers.ts:42:11 - error TS2550: Property 'replaceAll' does not exist on type 'string'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.

42         ).replaceAll('+', '%20')}`,
             ~~~~~~~~~~


Found 1 error in node_modules/@algolia/client-common/src/transporter/helpers.ts:42


Error: functions predeploy error: Command terminated with non-zero exit code 2
@risalfajar risalfajar added the bug label Oct 4, 2024
@Haroenv
Copy link
Contributor

Haroenv commented Oct 7, 2024

Could it be that you're deploying to an old node version that doesn't have replaceAll? Earliest would be 15.

@risalfajar
Copy link
Author

I'm using Node 20

@risalfajar
Copy link
Author

I don't understand, why is this closed?

@Haroenv
Copy link
Contributor

Haroenv commented Oct 8, 2024

@shortcuts has created a pull request that removes the usage of replaceAll (in algolia/api-clients-automation#3897). In the next version of the client this issue will be fixed

@shortcuts
Copy link
Member

Hey, sorry I had an issue with the release, I'm fixing it right now and will schedule a release right

@shortcuts
Copy link
Member

hey @risalfajar, in 5.8.0 replaceAll has been dropped in favor of replace, do you still have an issue?

@risalfajar
Copy link
Author

I've upgraded to 5.8.0 and it works now. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants