[GH-ISSUE #739] nodejs: always referencing http://storage:8080/ no matter how I change my environment variables #126

Closed
opened 2026-03-03 12:08:32 +03:00 by kerem · 2 comments
Owner

Originally created by @iiian on GitHub (Apr 6, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/739

Heyo. So I'm using nodejs with fsouza/fake-gcs-server, and my service is practically verbatim what you have in the node directory:

storage:
    image: fsouza/fake-gcs-server
    ports: ['8080:8080']
    volumes: ['./.tmp/storage/data:/data']
    command: ["-scheme", "http", "-port", "8080", "-external-url", "http://localhost:8080", "-backend", "filesystem", "-filesystem-root", "/data"]

However, when I try and save a file, without fail, I'm always confronted with, essentially, the following error:

FetchError {
      message: 'request to http://storage:8080/upload/resumable/b81202ce46c44fcd3cf2183672ac3331 failed, reason: getaddrinfo ENOTFOUND storage',
      type: 'system',
      errno: 'ENOTFOUND',
      code: 'ENOTFOUND',
      config: {
        method: 'PUT',
        url: 'http://storage:8080/upload/resumable/b81202ce46c44fcd3cf2183672ac3331',
        headers: {
          'Content-Length': 0,
          'Content-Range': 'bytes */*',
          Accept: 'application/json'
        },
        validateStatus: [Function (anonymous)],
        paramsSerializer: [Function: paramsSerializer],
        responseType: 'json'
      }
    }

Now of course, storage is the name of my service, but I've tried both of:

new Storage({
  apiEndpoint: 'http://storage:8080',
  projectId: 'test'
});

new Storage({
  apiEndpoint: 'http://localhost:8080',
  projectId: 'test'
});

as my base client. same result regardless. Furthermore, I have tried both apiEndpoints inside a docker network and external to a network (just in a ts-node repl).

The only solution left in my head is that there is a file getting cached somewhere for the @google-cloud/storage npm library. Anyway, maybe this is the wrong community to toss that into, but I thought I'd check here first.

Originally created by @iiian on GitHub (Apr 6, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/739 Heyo. So I'm using `nodejs` with `fsouza/fake-gcs-server`, and my service is practically verbatim what you have in the node directory: ```yaml storage: image: fsouza/fake-gcs-server ports: ['8080:8080'] volumes: ['./.tmp/storage/data:/data'] command: ["-scheme", "http", "-port", "8080", "-external-url", "http://localhost:8080", "-backend", "filesystem", "-filesystem-root", "/data"] ``` However, when I try and save a file, without fail, I'm always confronted with, essentially, the following error: ``` FetchError { message: 'request to http://storage:8080/upload/resumable/b81202ce46c44fcd3cf2183672ac3331 failed, reason: getaddrinfo ENOTFOUND storage', type: 'system', errno: 'ENOTFOUND', code: 'ENOTFOUND', config: { method: 'PUT', url: 'http://storage:8080/upload/resumable/b81202ce46c44fcd3cf2183672ac3331', headers: { 'Content-Length': 0, 'Content-Range': 'bytes */*', Accept: 'application/json' }, validateStatus: [Function (anonymous)], paramsSerializer: [Function: paramsSerializer], responseType: 'json' } } ``` Now of course, `storage` is the name of my service, but I've tried both of: ```javascript new Storage({ apiEndpoint: 'http://storage:8080', projectId: 'test' }); new Storage({ apiEndpoint: 'http://localhost:8080', projectId: 'test' }); ``` as my base client. same result regardless. Furthermore, I have tried both `apiEndpoints` inside a docker network _and_ external to a network (just in a `ts-node repl`). The only solution left in my head is that there is a file getting cached somewhere for the `@google-cloud/storage` npm library. Anyway, maybe this is the wrong community to toss that into, but I thought I'd check here first.
kerem closed this issue 2026-03-03 12:08:32 +03:00
Author
Owner

@iiian commented on GitHub (Apr 9, 2022):

Not sure what the problem was, but I've worked my way around it.

<!-- gh-comment-id:1094130363 --> @iiian commented on GitHub (Apr 9, 2022): Not sure what the problem was, but I've worked my way around it.
Author
Owner

@kutsan commented on GitHub (May 21, 2025):

Not sure what the problem was either. Docs weren't good, but I managed to solve it using -external-url http://storage:4443. storage is my container name.

My docker-compose.yml file:

services:
  other-services:
    ...

  storage:
    container_name: storage
    image: fsouza/fake-gcs-server:latest
    restart: unless-stopped
    ports:
      - "4443:4443"
    volumes:
      - storage-data:/var/lib/storage
    command:
      - "-data"
      - "/var/lib/storage"
      - "-scheme"
      - "http"
      - "-external-url"
      - "http://storage:4443"
      - "-port"
      - "4443"

volumes:
  storage-data:
    driver: local
<!-- gh-comment-id:2898398393 --> @kutsan commented on GitHub (May 21, 2025): Not sure what the problem was either. Docs weren't good, but I managed to solve it using `-external-url http://storage:4443`. `storage` is my container name. My `docker-compose.yml` file: ```yaml services: other-services: ... storage: container_name: storage image: fsouza/fake-gcs-server:latest restart: unless-stopped ports: - "4443:4443" volumes: - storage-data:/var/lib/storage command: - "-data" - "/var/lib/storage" - "-scheme" - "http" - "-external-url" - "http://storage:4443" - "-port" - "4443" volumes: storage-data: driver: local ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#126
No description provided.