Question

Functions - Golang: cannot download modules

I’m trying to use DigitalOceans Functions with Golang. I have the requirement to in part use private GO modules. I managed to get the functions to build and run in the APP Platform with Env Variables and creating a .netrc file in a build script. The problem I’m facing with Functions in the App Platform environment is that actual runtime logs don’t seem to be accesssible. The only runtime logs which are shown are an aggregate of the entire project (which includes several packages and functions) and unfortunately only simplified build logs and not real runtime logs. I also tried log forwarding to a managed OpeanSearch but this does not work as well. It seems to me that the level of control on functions inside of App Platform is greatly reduced.

So I switched back to functions in namespaces and inside the actual functions environment. Using the .netrc trick i described above works relatively OK so far. I still have to hardcode the credetials into the build script as for some reason the .env file is not being read. The initial build process works fine, which the logs confirm as all modules were pulled.

Unfortunately, as soon as I then try to invoke the function I receive an error: cannot download modules, there are no further logs availble. My assumption is that some parts which are included during the initial remote build are included but not when invoking the function.

Is anybody able to help on this? I’m at my whits end here trying to understand what the underlying issue is.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey @setorblagogeeseal,

I’ve not tested this with a private Go module, but can confirm that this works with public ones as shown in this example repo here:

https://github.com/digitalocean/sample-functions-golang-presigned-url/blob/main/packages/presign/url/go.mod

If you are still seeing that problem with a private one, what you could try doing is reaching out to the DigitalOcean support team who might be able to advise you further:

https://www.digitalocean.com/support/

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.