Skip to content

Commit

Permalink
chore: replaces use of localhost with 127.0.0.1 for better node 18 su…
Browse files Browse the repository at this point in the history
…pport
  • Loading branch information
krpeacock committed Oct 26, 2023
1 parent 75fcb03 commit d13c868
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 104 deletions.
2 changes: 1 addition & 1 deletion demos/sample-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

1. Ensure all dependencies are installed: `npm install`
2. Run the development server `npm run develop`
3. Visit the running site at http://localhost:8080
3. Visit the running site at http://127.0.0.1:8080
1 change: 1 addition & 0 deletions docs/generated/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Agent-JS Changelog</h1>
<section>
<h2>Version x.x.x</h2>
<ul>
<li>chore: replaces use of localhost with 127.0.0.1 for better node 18 support</li>
<li>feat: retry logic will catch and retry for thrown errors</li>
<li>
feat!: adds certificate logic to decode subnet and node key paths from the hashtree.
Expand Down
2 changes: 1 addition & 1 deletion e2e/browser/.proxyrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/api": {
"target": "http://localhost:4943/",
"target": "http://127.0.0.1:4943/",
}
}
4 changes: 2 additions & 2 deletions e2e/node/basic/canisterStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ afterEach(async () => {
describe('canister status', () => {
it('should fetch successfully', async () => {
const counterObj = await (await counter)();
const agent = new HttpAgent({ host: `http://localhost:${process.env.REPLICA_PORT}` });
const agent = new HttpAgent({ host: `http://127.0.0.1:${process.env.REPLICA_PORT}` });
await agent.fetchRootKey();
const request = await CanisterStatus.request({
canisterId: Principal.from(counterObj.canisterId),
Expand All @@ -21,7 +21,7 @@ describe('canister status', () => {
});
it('should throw an error if fetchRootKey has not been called', async () => {
const counterObj = await (await counter)();
const agent = new HttpAgent({ host: `http://localhost:${process.env.REPLICA_PORT}` });
const agent = new HttpAgent({ host: `http://127.0.0.1:${process.env.REPLICA_PORT}` });
const shouldThrow = async () => {
// eslint-disable-next-line no-useless-catch
try {
Expand Down
2 changes: 1 addition & 1 deletion e2e/node/canisters/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function noncelessCanister(): Promise<{

export const createActor = async (options?: HttpAgentOptions) => {
const module = readFileSync(path.join(__dirname, 'counter.wasm'));
const agent = new HttpAgent({ host: `http://localhost:${process.env.REPLICA_PORT}`, ...options });
const agent = new HttpAgent({ host: `http://127.0.0.1:${process.env.REPLICA_PORT}`, ...options });
await agent.fetchRootKey();

const canisterId = await Actor.createCanister({ agent });
Expand Down
138 changes: 80 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ For example,
import fetch from 'isomorphic-fetch';
import { HttpAgent } from '@dfinity/agent';

const host = process.env.DFX_NETWORK === 'local' ? 'http://localhost:4943' : 'https://icp-api.io';
const host = process.env.DFX_NETWORK === 'local' ? 'http://127.0.0.1:4943' : 'https://icp-api.io';

const agent = new HttpAgent({ fetch, host });
```
Expand All @@ -99,7 +99,7 @@ For example,
import fetch from 'isomorphic-fetch';
import { HttpAgent } from '@dfinity/agent';

const host = process.env.DFX_NETWORK === 'local' ? 'http://localhost:4943' : 'https://ic0.app';
const host = process.env.DFX_NETWORK === 'local' ? 'http://127.0.0.1:4943' : 'https://ic0.app';

/**
* @type {RequestInit}
Expand Down
Loading

0 comments on commit d13c868

Please sign in to comment.