Problem to deploy function

problem to auth in private repository in function deploy 
command: `gcloud functions deploy...`

iam using privates packages in artifacty registry

informed in requirement.txt:
--extra-index-url https://oauth2accesstoken:<token>@<region>-python.pkg.dev/<project>/python/simple/

log errors:
Step #2 - "build": Looking in indexes: https://pypi.org/simple, https://oauth2accesstoken:****@<region>-python.pkg.dev/<project>/python/simple/
Step #2 - "build": WARNING: 401 Error, Credentials not correct for https://<region>-python.pkg.dev/<project>/python/simple/requests/

but, if I delete the function or change the region, the deployment completes successfully

the problem seems to be in some gcloud build cache

Has anyone experienced this problem?


1 1 59
1 REPLY 1

Hello @carloscruz  ,Welcome on Google Cloud Community.

Well, from logs sample, it looks like you are using wrong credentials for obtaining package repository hosted at 

https://<region>-python.pkg.dev/<project>/python/simple/requests/

Are you able to copy/paste logs taken from  Logs Explorer ? They should be more detailed than this. 

Apart from logs, few general steps you can take to handle this issue:

  1. Double-check Credentials: Ensure that the username and password or token you're using to authenticate with the package repository are correct. Typos or incorrect credentials could lead to authentication failures.

  2. Verify Access Permissions: Make sure that the credentials you're using have the necessary permissions to access the requested resource. If the credentials are correct but lack sufficient permissions, you'll encounter authentication errors.

  3. Review Repository Configuration: Check the configuration of your package manager or build system to ensure that it's correctly configured to use the appropriate credentials for accessing the package repository.

  4. Test Access Outside of Build Process: If possible, try accessing the package repository directly using the same credentials outside of the build process. This can help verify whether the issue is specific to the build environment or if it's a more general authentication problem.

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost