OpenSteer cloud mode provides managed browser infrastructure with the same API surface as local mode. Enable cloud execution with simple configuration - no code changes required.
Cloud mode is fail-fast and does not automatically fall back to local mode.
try { const opensteer = new Opensteer({ cloud: { apiKey: 'invalid_key' } }) await opensteer.launch()} catch (error) { // Cloud authentication or connection failed console.error('Cloud mode failed:', error) // Does NOT fall back to local}
// Good - never commit API keysconst opensteer = new Opensteer({ cloud: { apiKey: process.env.OPENSTEER_API_KEY }})// Bad - hardcoded credentialsconst opensteer = new Opensteer({ cloud: { apiKey: 'ork_your_key' }})
Store session URLs for debugging
await opensteer.launch()const sessionUrl = opensteer.getCloudSessionUrl()// Log for debuggingconsole.log('Session URL:', sessionUrl)// Or store in database for audit trailawait db.sessions.create({ url: sessionUrl, timestamp: new Date()})
Use same code for local and cloud
// Automatically switches based on OPENSTEER_MODE envconst opensteer = new Opensteer({ name: 'scraper' })try { await opensteer.launch() // ... same automation code works in both modes} finally { await opensteer.close()}
Set appropriate announcement policy
// Development - always show URLsconst opensteer = new Opensteer({ cloud: { apiKey: process.env.OPENSTEER_API_KEY, announce: 'always' }})// Production - suppress URLs in logsconst opensteer = new Opensteer({ cloud: { apiKey: process.env.OPENSTEER_API_KEY, announce: 'off' }})
// Before (local mode)await opensteer.uploadFile({ description: 'file input', paths: ['./file.pdf'] })await opensteer.exportCookies('./cookies.json')// After (cloud mode)// Use alternative approaches or handle in application layer
const opensteer = new Opensteer({ cloud: { apiKey: process.env.OPENSTEER_API_KEY }})try { await opensteer.launch() // Run full test suite await runTests(opensteer) console.log('Cloud mode working correctly')} finally { await opensteer.close()}