Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BUG] in sample: taskqueues-backup-images #1143

Open
Labels
@CoocooFroggy

Description

@CoocooFroggy

Which sample has a bug?

asyncfunctiongetFunctionUrl(name,location="us-central1"){
if(!auth){
auth=newGoogleAuth({
scopes:"https://www.googleapis.com/auth/cloud-platform",
});
}
constprojectId=awaitauth.getProjectId();
consturl="https://cloudfunctions.googleapis.com/v2beta/"+
`projects/${projectId}/locations/${location}/functions/${name}`;
constclient=awaitauth.getClient();
constres=awaitclient.request({url});
consturi=res.data?.serviceConfig?.uri;
if(!uri){
thrownewError(`Unable to retreive uri for function at${url}`);
}
returnuri;
}

How to reproduce the issue

UsedgetFunctionUrl exactly as shown.

Steps to set up and reproduce

Attempt to queue a function using the code shown. EG:

constqueue=getFunctions().taskQueue("reminderEmail");consttargetUrl=awaitgetFunctionUrl("reminderEmail");queue.enqueue({bookingRequestId:event.params.docId},{scheduleTime:newDate(),uri:targetUrl,}).then(()=>{console.log(`Queued reminder email for${date}.`);});

Debug output

Status code7 (PERMISSION_DENIED)
Reason to retryPERMISSION_DENIED(7): HTTP status code 403
SCR-20240621-nrfl

Expected behavior

The function runs successfully. The documentation states,

Due to the way Cloud Tasks creates authentication tokens to authenticate requests to the underlying task queue functions, you must specify the Cloud Run URL of the function when enqueuing tasks. We recommend that you programmatically retrieve the URL for your function as demonstrated below...

However, the uri itself does not seem sufficient to authenticate the cloud function.

Actual behavior

The function is missing the necessary authentication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp