Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/commands/app/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class Dev extends BaseCommand {
const runOptions = {
skipActions: false,
skipServe: false,
strictMode: flags.strict,
parcel: {
logLevel: flags.verbose ? 'verbose' : 'warn',
// always set to false on localhost to get debugging and hot reloading
Expand Down Expand Up @@ -305,6 +306,10 @@ Dev.flags = {
default: false,
char: 'o'
}),
strict: Flags.boolean({
description: 'Run in strict mode, this will block non-web actions from being run directly',
defaullt: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo default

}),
extension: Flags.string({
description: 'Run only a specific extension, this flag can only be specified once',
char: 'e',
Expand Down
5 changes: 3 additions & 2 deletions src/lib/run-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ async function runDev (runOptions, config, _inprocHookRunner) {
const hasBackend = devConfig.app.hasBackend
const httpsSettings = runOptions?.parcel?.https

actionConfig.strictMode = runOptions.strictMode === true

serveLogger.debug('hasBackend', hasBackend)
serveLogger.debug('hasFrontend', hasFrontend)
serveLogger.debug('httpsSettings', JSON.stringify(httpsSettings, null, 2))
Expand Down Expand Up @@ -508,8 +510,7 @@ async function serveWebAction (req, res, actionConfig, distFolder, actionLoader
distFolder,
contextActionLoader: actionLoader
}

if (invoker && !sequence) {
if (invoker && !sequence && !actionConfig.strictMode) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the serveNonWebAction code? That needs to be resurrected here (it was deleted in the previous PR) and enabled by --strict. If not the e2e tests will fail since they expect 401s for non-web actions being called.

if (!isWebAction(contextItem)) {
actionLogger.warn('serving non-web action : this call will fail without credentials when deployed.')
}
Expand Down
Loading