firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.04k stars 952 forks source link

HTTP Error: 400, Invalid value at 'queue.retry_config.max_backoff' #4730

Closed scole954387 closed 2 years ago

scole954387 commented 2 years ago

Good evening. I just uploaded my functions without error and received the notice that firebase needed to be updated. I proceeded with the update via npm.

Immediately after the update I went to upload the functions again just to ensure everything still works and this time it failed. No changes were made to the function being uploaded. It worked right before but not after the upgrade.

Any idea what's on the go? Thanks.

Here's the error: `i deploying functions Running command: npm --prefix "$RESOURCE_DIR" run lint

lint eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

build tsc

✔ functions: Finished running predeploy script. i functions: ensuring required API cloudfunctions.googleapis.com is enabled... i functions: ensuring required API cloudbuild.googleapis.com is enabled... i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled... ✔ artifactregistry: required API artifactregistry.googleapis.com is enabled ✔ functions: required API cloudbuild.googleapis.com is enabled ✔ functions: required API cloudfunctions.googleapis.com is enabled i functions: preparing codebase default for deployment i functions: preparing functions directory for uploading... i functions: packaged /Users/shannoncole/Development/Skip2Quick/functions (711.79 KB) for uploading i functions: ensuring required API cloudtasks.googleapis.com is enabled... ✔ functions: required API cloudtasks.googleapis.com is enabled ✔ functions: functions folder uploaded successfully i functions: updating Node.js 16 function processSalesReceiptReport(us-central1)... i functions: updating Node.js 16 function processExpenseReport(us-central1)... i functions: updating Node.js 16 function salesReceiptAdded(us-central1)... i functions: updating Node.js 16 function expenseAdded(us-central1)... HTTP Error: 400, Invalid value at 'queue.retry_config.max_backoff' (type.googleapis.com/google.protobuf.Duration), Field 'maxBackoff', Invalid duration format, failed to parse seconds Invalid value at 'queue.retry_config.min_backoff' (type.googleapis.com/google.protobuf.Duration), Field 'minBackoff', Invalid duration format, failed to parse seconds Invalid value at 'queue.retry_config.max_retry_duration' (type.googleapis.com/google.protobuf.Duration), Field 'maxRetryDuration', Invalid duration format, failed to parse seconds HTTP Error: 400, Invalid value at 'queue.retry_config.max_backoff' (type.googleapis.com/google.protobuf.Duration), Field 'maxBackoff', Invalid duration format, failed to parse seconds Invalid value at 'queue.retry_config.min_backoff' (type.googleapis.com/google.protobuf.Duration), Field 'minBackoff', Invalid duration format, failed to parse seconds Invalid value at 'queue.retry_config.max_retry_duration' (type.googleapis.com/google.protobuf.Duration), Field 'maxRetryDuration', Invalid duration format, failed to parse seconds ✔ functions[expenseAdded(us-central1)] Successful update operation. ✔ functions[salesReceiptAdded(us-central1)] Successful update operation.

Functions deploy had errors with the following functions: processExpenseReport(us-central1) processSalesReceiptReport(us-central1) i functions: cleaning up build files... Error: There was an error deploying functions:

Error Failed to upsert task queue function processExpenseReport in region us-central1 Error Failed to upsert task queue function processSalesReceiptReport in region us-central1`

[REQUIRED] Environment info

firebase-tools:

Platform:

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

[REQUIRED] Expected behavior

[REQUIRED] Actual behavior

google-oss-bot commented 2 years ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

scole954387 commented 2 years ago

Sorry I missed the template and unable to find a way to delete the report. I'm sorry but I don't have time to go through for the required information right now. I just submitted this just before I had to run out.

scole954387 commented 2 years ago

Ok, here's something to add. I tried version 11.2.1 and it fails. I downgraded to 11.2.0 and it also fails however when I downgrade to 11.1.0 it successfully uploads the functions without any errors. So it appears the problem started after 11.1.0. I'll be back on my computer later if you need any additional information and once again I apologize for not following the template.

taeold commented 2 years ago

@scole954387 Thanks for reporting the issue.

Could you share some snippets of the code that is failing to deploy. We don't need to see your source - I think just sharing the the type of the function and its configuration would help us alot.

gustavopch commented 2 years ago

@taeold Same happening here for the 2 task queue functions that I have in the project after upgrading from v11.1.0 to v11.2.2. They're both implemented like this:

export const publish = Functions.region('southamerica-east1')
  .runWith({ timeoutSeconds: 3 * 60 })
  .tasks.taskQueue({
    retryConfig: {
      maxAttempts: 5,
      minBackoffSeconds: 60,
    },
    rateLimits: {
      maxConcurrentDispatches: 50,
    },
  })
  .onDispatch(...)

Is that info enough or do you need something else?

wjcarroll commented 2 years ago

I just ran into the same problem using 11.2 as well when deploying this taskQueue function

export const updateGames = functions
    .runWith({ secrets: ['TWITCH_CLIENT_SECRET'], timeoutSeconds: 540 })
    .tasks.taskQueue({ retryConfig: { maxAttempts: 5, minBackoffSeconds: 30 }, rateLimits: { maxConcurrentDispatches: 8, maxDispatchesPerSecond: 3 } })
    .onDispatch(_updateGames);
scole954387 commented 2 years ago

My code is like the example that gusta provided. Let me know if his code is enough or you need something from me too. Thanks!

scole954387 commented 2 years ago
export const processSalesReceiptReport = functions.tasks
  .taskQueue({
    retryConfig: {
      maxAttempts: 5,
      minBackoffSeconds: 60,
    },
    rateLimits: {
      maxConcurrentDispatches: 5,
    },
  })
  .onDispatch(async (data) => {
   // do something
}
icopp commented 2 years ago

I also ran into the same problem with the Firebase cloud functions v2 beta:

import { onTaskDispatched } from 'firebase-functions/v2/tasks';

const dosomethinginbulk = onTaskDispatched(
  {
    rateLimits: { maxConcurrentDispatches: 50 },
    retryConfig: { maxAttempts: 5, minBackoffSeconds: 60 },
  },
  async ({ data: { someParam } }) => {
    // ... Do stuff here
  }
)
export default dosomethinginbulk;

Installing firebase-tools@11.1.0 seems to have fixed the issue.

taeold commented 2 years ago

Sorry folks. The fix for this issue was merged https://github.com/firebase/firebase-tools/pull/4791.

We will be rolling out the updated CLI soon. Thanks for your patience.

taeold commented 2 years ago

Hey folks. We released 11.4.2 which includes fixed for this issue. Thank you all for your patience.

michaelangeloio commented 2 years ago

Hi @taeold ! I still seem to be getting this issue with 11.4.2 installed. I'm using yarn workspaces, however I've completely cleared my node_modules, yarn.lock, and all cache. Here are some details:

export const stravaShortTermSyncBackup = functions
  .runWith({ memory: '8GB', timeoutSeconds: 540 })
  .tasks.taskQueue({
    retryConfig: {
      maxAttempts: 5,
      minBackoffSeconds: 60 * 5,
    },
    rateLimits: {
      maxConcurrentDispatches: 10,
    },
  })
  .onDispatch(async (data: { snap: FirebaseFirestore.DocumentData; context: functions.EventContext }) => {
...
    "firebase-tools": "^11.4.2",