Google Cloud Storage library error inside docker, but outside on my pc it's working fine.
The library in question is this :-
"@google-cloud/storage": "npm:@google-cloud/storage@^7.11.2",
Inside the code, the library simply download a json file from google storage.
When I run code outside the docker container locally, it works fine and is able to download the file.
The dockerfile I'm currently using is this :-
I've already tried using deno's official image FROM denoland/deno:latest
and install nodejs inside it, but it throws the same error.3 Replies
And here's the error :-
can't paste it all in one go without discord nitro 🙏
An Update :-
- I was using podman instead of docker, and it wasn't working inside podman.
- I installed docker again and tried with docker, and it works fine.
I think there was some problem with podman's network configs or something that wasn't allowing that google library to connect to
https://googleapis.com/v4
(something like this url) to verify token and stuff.
For now, I don't have patience to figure out a way to make it work in podman 😓 , so I'll just take docker.
PS: Also deployed this container image (using podman itself) to google cloud run and it works fine over there as well. ✌️I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided in your message, I can offer some general advice.
Firstly, it's important to note that the
@google-cloud/storage
library you're using is an npm package, which is designed to be used with Node.js, not Deno. Deno does not use npm packages directly as it has a different module system. If you're trying to use an npm package within Deno, you would typically need to use a compatibility layer or find an equivalent Deno module.
In your Dockerfile, you're using a Node.js base image and then copying Deno into it. This setup can work, but it's not typical for Deno applications. Deno applications usually don't require Node.js, and vice versa.
Here are a few things you might want to check or try:
1. Ensure that the environment variables and credentials required by the @google-cloud/storage
library are correctly set up in your Docker container. These might include GOOGLE_APPLICATION_CREDENTIALS
or other related environment variables.
2. Verify that the network configuration in your Docker container allows for outbound connections to Google Cloud Storage.
3. If you're using Deno, consider looking for a Deno module that provides Google Cloud Storage functionality, or use the Deno FFI (Foreign Function Interface) to interact with the Google Cloud Storage C++ client libraries.
4. If you need to use the @google-cloud/storage
npm package, you might want to stick with a Node.js environment rather than trying to integrate it with Deno.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If you continue to experience issues, you may want to seekassistance from the community or the maintainers of the
@google-cloud/storage
library for more Docker-specific troubleshooting.