Getting 407 when using storage

Trying to store some data with { storage } from ‘@forge/api’

I am getting:
ERROR 21:02:16.934 65efc535-724b-43c6-9d4f-67996567a7b6 Error Saving: APIError: Unknown error. Received status code ‘407’
at Function.forStatus (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/errors.js:32:1)
at getResponseBody (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:14:1)
at GlobalStorage.mutation (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:121:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at GlobalStorage.set (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:71:1)
at onSubmit (webpack://jira-service-management-assets-import-type-ui-kit/src/index.jsx:23:1)
at Object.onSaveFn (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/components.js:166:1)
at (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:31:1)
at asyncMap (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:13:1)
at (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:34:1)
ERROR 21:02:16.934 65efc535-724b-43c6-9d4f-67996567a7b6 APIError: Unknown error. Received status code ‘407’
at Function.forStatus (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/errors.js:32:1)
at getResponseBody (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:14:1)
at GlobalStorage.mutation (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:121:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at GlobalStorage.set (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/storage/out/global-storage.js:71:1)
at onSubmit (webpack://jira-service-management-assets-import-type-ui-kit/src/index.jsx:23:1)
at Object.onSaveFn (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/components.js:166:1)
at (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:31:1)
at asyncMap (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:13:1)
at (webpack://jira-service-management-assets-import-type-ui-kit/node_modules/@forge/ui/out/reconcile.js:34:1)

Code after being submitted in a form:

try {
    await storage.set('SFTPHost', sftp_host_temp);
    await storage.set('SFTPPort', sftp_port);
    await storage.set('SFTPUser', sftp_user);
    await storage.set('SFTPPassword', sftp_password);
    await storage.set('SFTPPath', sftp_path);
    await storage.set('objectType', objectType);
} catch (err) {
  console.error('Error Saving:', err);
  throw err;
  }

Hi @Atze. Welcome to the developer community. I wasn’t able to reproduce the bug. Are any of the values being saved successfully? You can view stored values via the developer console (select app name, storage on left nav, development for environment, and then name of the instance/site in text field).

If there are some values being saved, can you isolate which one isn’t making it? That might help to figure out if it’s a bad value or object type that might be triggering this error. Admittedly, 407 is an odd one to see, but that might just be misleading / inappropriate (we’ll dig into that further once we have more information).

Thanks @nmansilla for looking into this. I figured my libraries were outdated, updating did the trick.

1 Like