Skip to content

Commit

Permalink
ALL-9108 Fix tatum connector undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj.bacovcin committed Oct 9, 2024
1 parent 6ff4ab2 commit 90f9caa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [4.2.43] - 2024.10.9

### Fixed

- Fixed Tatum Connector issue with process is undefined on the pure browser

## [4.2.42] - 2024.9.4

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "4.2.42",
"version": "4.2.43",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
4 changes: 2 additions & 2 deletions src/connector/tatum.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import process from 'process'
import { Container, Service } from 'typedi'
import { JsonRpcCall } from '../dto'
import { ApiVersion } from '../service'
import { CONFIG, Constant, Utils } from '../util'
import { CONFIG, Constant, EnvUtils, Utils } from '../util'
import { DefaultBodyType, DefaultParamsType, FileUploadRequest, GetUrl, SdkRequest } from './connector.dto'

@Service({
Expand Down Expand Up @@ -150,7 +150,7 @@ export class TatumConnector {

private getBaseUrl() {
const config = Container.of(this.id).get(CONFIG)
if (process.env.TATUM_URL) {
if (EnvUtils.isProcessAvailable() && process.env?.TATUM_URL) {
return process.env.TATUM_URL
}
return config.version === ApiVersion.V3 ? Constant.TATUM_API_URL.V3 : Constant.TATUM_API_URL.V4
Expand Down
4 changes: 2 additions & 2 deletions src/service/rpc/generic/LoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GetI } from '../../../dto/GetI'
import { PostI } from '../../../dto/PostI'
import { AbstractRpcInterface } from '../../../dto/rpc/AbstractJsonRpcInterface'
import { Logger } from '../../../service/logger/logger.types'
import { CONFIG, Constant, LOGGER, Utils } from '../../../util'
import { CONFIG, Constant, EnvUtils, LOGGER, Utils } from '../../../util'
import { RpcNode, RpcNodeType } from '../../tatum'

interface RpcStatus {
Expand Down Expand Up @@ -100,7 +100,7 @@ export class LoadBalancer implements AbstractRpcInterface {
await this.initRemoteHostsUrls()
}

if (typeof process !== 'undefined' && process.release && process.release.name === 'node') {
if (EnvUtils.isProcessAvailable() && process.release && process.release.name === 'node') {
process.on('exit', () => this.destroy())
}

Expand Down

0 comments on commit 90f9caa

Please sign in to comment.