Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in companion server while upgraded NuGet Packages #5385

Open
2 tasks done
AbhishekSankhyan opened this issue Aug 2, 2024 · 4 comments
Open
2 tasks done
Assignees
Labels

Comments

@AbhishekSankhyan
Copy link

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

Upgrade to latest companion packages

Expected behavior

It should work fine

Actual behavior

Getting below error while upgraded companion server packages.

Error Details:
Error: The Provider option "providerOptions.s3" is no longer supported. Please use the option "s3" instead.
0|index | at /home/ec2-user/server/node_modules/@uppy/companion/lib/config/companion.js:90:23
0|index | at Array.forEach ()
0|index | at validateConfig (/home/ec2-user/server/node_modules/@uppy/companion/lib/config/companion.js:88:40)
0|index | at Object.module.exports.app (/home/ec2-user/server/node_modules/@uppy/companion/lib/companion.js:67:5)
0|index | at Object. (/home/ec2-user/server/index.js:78:19)
0|index | at Module._compile (node:internal/modules/cjs/loader:1108:14)
0|index | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
0|index | at Module.load (node:internal/modules/cjs/loader:988:32)
0|index | at Function.Module._load (node:internal/modules/cjs/loader:828:14)
0|index | at Object. (/root/.nvm/versions/node/v16.0.0/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)

Companion server packages:

"dependencies": {
"@angular/cli": "^18.1.3",
"@babel/core": "^7.2.2",
"@uppy/companion": "^5.0.4",
"@uppy/core": "^4.1.0",
"@uppy/dashboard": "^4.0.2",
"@uppy/google-drive": "^4.0.0",
"@uppy/xhr-upload": "^4.0.2",
"babelify": "^10.0.0",
"body-parser": "^1.18.3",
"budo": "^11.6.1",
"cookie-parser": "^1.4.4",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.3",
"uppy": "^1.29.1"
}

Code snippet:

const corsOptions = {
origin: '*',
credentials: true,
allowedHeaders: ['Authorization', 'Origin', 'Content-Type', 'Accept', 'uppy-auth-token'], // 'uppy-auth-token' is required!
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE', 'OPTIONS'], // make sure OPTIONS is included
optionsSuccessStatus: 200,
}

app.use(cors(corsOptions))

const options = {
providerOptions: {
drive: {
key: '',
secret: '
'
},
onedrive : {
key: '',
secret: '
'
},
dropbox : {
key:'',
secret:'
'
},
s3: {
getKey: (req, filename) =>{
return uploads/${filename};
} ,
key: '',
secret: '
',
bucket: '',
region: '
',
useAccelerateEndpoint: false, // default: false,
expires: 3600, // default: 300 (5 minutes)
acl: 'private', // default: none
},
},
server: {
host: '******',
protocol: 'https',
},
filePath: DATA_DIR,
secret: 'blah blah',
debug: true,
}

Please suggest what changes required in above code to resolve this issue.

@dev-android1
Copy link

Please help us to resolve this issue.

@AbhishekSankhyan
Copy link
Author

Done few modifications in companion server code and now getting below error:

0|index | Fri, 02 Aug 2024 18:33:34 GMT express-session deprecated undefined resave option; provide resave option at index.js:17:35
0|index | Fri, 02 Aug 2024 18:33:34 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at index.js:17:35
0|index | /home/ec2-user/server/tmp
0|index | companion: 2024-08-02T18:33:34.530Z [error] startup.uploadUrls Running without uploadUrls is a security risk and Companion will refuse to start up when running in production (NODE_ENV=production)
0|index | TypeError: Option corsOrigins is required. To disable security, pass true

@AbhishekSankhyan
Copy link
Author

I have also gone through your code sandbox, but it also has the old code examples:

https://codesandbox.io/p/devbox/uppy-exampleaws-companion-5giel?file=/server.js:20,20

please share link for the companion server code examples with latest packages.

@AbhishekSankhyan
Copy link
Author

AbhishekSankhyan commented Aug 3, 2024

0|index | TypeError: Option corsOrigins is required. To disable security, pass true

Getting this error. I have done all possible cors setting but still getting this error. As per Uppy Companion documentation corsOrigin is required so please let us know what changes required in code to fix this issue.

https://uppy.io/docs/companion/#corsorigins-required

0|index | at validateConfig (/home/ec2-user/server/node_modules/@uppy/companion/lib/config/companion.js:100:15)
0|index | at Object.module.exports.app (/home/ec2-user/server/node_modules/@uppy/companion/lib/companion.js:67:5)
0|index | at Object. (/home/ec2-user/CompanionServer/index.js:63:19)
0|index | at Module._compile (node:internal/modules/cjs/loader:1108:14)
0|index | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
0|index | at Module.load (node:internal/modules/cjs/loader:988:32)
0|index | at Function.Module._load (node:internal/modules/cjs/loader:828:14)
0|index | at Object. (/root/.nvm/versions/node/v16.0.0/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|index | at Module._compile (node:internal/modules/cjs/loader:1108:14)
0|index | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants