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

Check for process existence before accessing it #147

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

omarestrella
Copy link
Contributor

Problem

On some edge platforms (specifically Cloudflare Workers), process does not exist at all, so checking !process isn't enough and causes a runtime error / crash.

Solution

I added a typeof process check before any process access occurs so that the Pinecone client works on non-Node runtimes.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

No test changes should be necessary, as this is just a more strict !process check.

@jhamon
Copy link
Collaborator

jhamon commented Oct 23, 2023

Thanks for the fix. If you run npm run format and commit the diff that will fix the lint/format check. The rest are failing due to environment variables being withheld for security reasons so shouldn't be a concern.

@omarestrella
Copy link
Contributor Author

Thanks for the fix. If you run npm run format and commit the diff that will fix the lint/format check. The rest are failing due to environment variables being withheld for security reasons so shouldn't be a concern.

Gotcha, formatting should be fixed.

Copy link
Contributor

@austin-denoble austin-denoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks again for the fix.

Copy link
Collaborator

@jhamon jhamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

@jhamon jhamon merged commit f01c02b into pinecone-io:main Oct 24, 2023
3 of 19 checks passed
@austin-denoble
Copy link
Contributor

This fix has been included in the v1.1.2 release: https://github.com/pinecone-io/pinecone-ts-client/releases/tag/v1.1.2.

Thanks again for contributing!

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

Successfully merging this pull request may close these issues.

3 participants