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

EHOSTDOWN error is not thrown #4548

Open
weyert opened this issue Sep 7, 2023 · 2 comments
Open

EHOSTDOWN error is not thrown #4548

weyert opened this issue Sep 7, 2023 · 2 comments
Labels
bug Something isn't working web-api Something that relates to a standard Web API

Comments

@weyert
Copy link
Contributor

weyert commented Sep 7, 2023

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

  1. npm init -y
  2. npm install gcp-metadata@5.0.1
  3. Create file with the contents below and name it index.mjs
  4. Execute bun run ./index.mjs
// file: index.mjs
import gcpMetadata from "gcp-metadata";

const projectId = await gcpMetadata.project();
console.log(`projectId:`, projectId);

What is the expected behavior?

I would expect it to throw an EHOSTDOWN error

In Node.js it throws the following the error:

FetchError: request to http://169.254.169.254/computeMetadata/v1/project failed, reason: connect EHOSTDOWN 169.254.169.254:80 - Local (192.168.0.218:61883)
    at ClientRequest.<anonymous> (/Users/weyert/Development/Projects/Experiments/bun-gcp-metadata/node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketErrorListener (node:_http_client:502:9)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'EHOSTDOWN',
  code: 'EHOSTDOWN',
  config: {
    url: 'http://169.254.169.254/computeMetadata/v1/project',
    headers: { 'Metadata-Flavor': 'Google' },
    retryConfig: {
      noResponseRetries: 3,
      currentRetryAttempt: 3,
      retry: 3,
      httpMethodsToRetry: [ 'GET', 'HEAD', 'PUT', 'OPTIONS', 'DELETE' ],
      statusCodesToRetry: [ [ 100, 199 ], [ 429, 429 ], [ 500, 599 ] ]
    },
    responseType: 'text',
    timeout: 3000,
    paramsSerializer: [Function: paramsSerializer],
    validateStatus: [Function: validateStatus],
    method: 'GET'
  }
}

What do you see instead?

Nothing the script keeps running without errors

Additional information

Partly blocks using Bun on Google Cloud Platform

@weyert weyert added the bug Something isn't working label Sep 7, 2023
@weyert
Copy link
Contributor Author

weyert commented Sep 8, 2023

For an example, how it is used in a production project:
https://github.com/weyert/bun-opentelemetry/blob/main/README.md

@weyert
Copy link
Contributor Author

weyert commented Sep 8, 2023

Still broken in 1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working web-api Something that relates to a standard Web API
Projects
None yet
Development

No branches or pull requests

2 participants