detroitenglish / cloudflare-workers-webpack-boilerplate Goto Github PK
View Code? Open in Web Editor NEWA superbly simple, minimal-config template for building, bundling and deploying Cloudflare Workers with Webpack ๐
License: MIT License
A superbly simple, minimal-config template for building, bundling and deploying Cloudflare Workers with Webpack ๐
License: MIT License
I'm getting an error
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output.path: The provided value "dist" is not an absolute path!
-> The output directory as **absolute path** (required).
my background is C# so am not up-to-date with webpack and npm enough to fix diagnose this. Any help would be great
There should be a config option to not delete existing routes, and it should be enabled by default to avoid accidentally deleting routes.
I am unable to deploy excample scripts:
cloudflare-worker-webpack-boilerplate dschmidt$ clear
ubm-dschmidt-mb:cloudflare-worker-webpack-boilerplate dschmidt$ npm run deploy
[email protected] deploy /Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate
cross-env WORKER_ACTION=deploy webpack --display none --bail
๐ง | Bundling Cloudflare Worker script
Uploading worker...
Success! Cloudflare worker deployed
{ Error: Request failed with status code 400
at createError (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/adapters/http.js:201:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 20000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json',
'X-Auth-Email': 'EMAIL_OBFUSCATED',
'X-Auth-Key': 'API_KEY_OBFUSCATED',
'User-Agent': 'axios/0.18.0',
'Content-Length': 29 },
method: 'post',
baseURL: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED',
url: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
data: '{"pattern":"","enabled":true}' },
request:
ClientRequest {
domain: null,
_events:
{ socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] },
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.cloudflare.com',
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.cloudflare.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 379,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 269,
[Symbol(bytesRead)]: 952 },
connection:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.cloudflare.com',
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.cloudflare.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 379,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 269,
[Symbol(bytesRead)]: 952 },
_header: 'POST /client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters HTTP/1.1\r\nAccept: application/json, text/plain, /\r\nContent-Type: application/json\r\nX-Auth-Email: EMAIL_OBFUSCATED\r\nX-Auth-Key: API_KEY_OBFUSCATED\r\nUser-Agent: axios/0.18.0\r\nContent-Length: 29\r\nHost: api.cloudflare.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent {
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] },
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
_ended: true,
res:
IncomingMessage {
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
redirects: [],
read: [Function] },
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable {
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 29,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters' },
[Symbol(outHeadersKey)]:
{ accept: [Array],
'content-type': [Array],
'x-auth-email': [Array],
'x-auth-key': [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array] } },
response:
{ status: 400,
statusText: 'Bad Request',
headers:
{ date: 'Thu, 14 Mar 2019 13:35:40 GMT',
'content-type': 'application/json; charset=UTF-8',
'content-length': '169',
connection: 'close',
'set-cookie': [Array],
'cf-ray': '4b76a1d4cc755a2c-BOS',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'served-in-seconds': '0.037',
'strict-transport-security': 'max-age=15780000; includeSubDomains',
server: 'cloudflare' },
config:
{ adapter: [Function: httpAdapter],
transformRequest: [Object],
transformResponse: [Object],
timeout: 20000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers: [Object],
method: 'post',
baseURL: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED',
url: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
data: '{"pattern":"","enabled":true}' },
request:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters HTTP/1.1\r\nAccept: application/json, text/plain, /\r\nContent-Type: application/json\r\nX-Auth-Email: EMAIL_OBFUSCATED\r\nX-Auth-Key: API_KEY_OBFUSCATED\r\nUser-Agent: axios/0.18.0\r\nContent-Length: 29\r\nHost: api.cloudflare.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
_ended: true,
res: [Object],
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Object],
[Symbol(outHeadersKey)]: [Object] },
data: { result: null, success: false, errors: [Array], messages: [] } } }
{ Error: Request failed with status code 400
at createError (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/Users/dschmidt/webpacktest/cloudflare-worker-webpack-boilerplate/cloudflare-worker-webpack-boilerplate/node_modules/axios/lib/adapters/http.js:201:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 20000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json',
'X-Auth-Email': 'EMAIL_OBFUSCATED',
'X-Auth-Key': 'API_KEY_OBFUSCATED',
'User-Agent': 'axios/0.18.0',
'Content-Length': 30 },
method: 'post',
baseURL: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED',
url: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
data: '{"pattern":"","enabled":false}' },
request:
ClientRequest {
domain: null,
_events:
{ socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] },
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.cloudflare.com',
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.cloudflare.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 380,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 295,
[Symbol(bytesRead)]: 952 },
connection:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.cloudflare.com',
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.cloudflare.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 380,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 295,
[Symbol(bytesRead)]: 952 },
_header: 'POST /client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters HTTP/1.1\r\nAccept: application/json, text/plain, /\r\nContent-Type: application/json\r\nX-Auth-Email: EMAIL_OBFUSCATED\r\nX-Auth-Key: API_KEY_OBFUSCATED\r\nUser-Agent: axios/0.18.0\r\nContent-Length: 30\r\nHost: api.cloudflare.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent {
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] },
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
_ended: true,
res:
IncomingMessage {
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
redirects: [],
read: [Function] },
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable {
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 30,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters' },
[Symbol(outHeadersKey)]:
{ accept: [Array],
'content-type': [Array],
'x-auth-email': [Array],
'x-auth-key': [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array] } },
response:
{ status: 400,
statusText: 'Bad Request',
headers:
{ date: 'Thu, 14 Mar 2019 13:35:40 GMT',
'content-type': 'application/json; charset=UTF-8',
'content-length': '169',
connection: 'close',
'set-cookie': [Array],
'cf-ray': '4b76a1d5fc2aae0e-BOS',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'served-in-seconds': '0.040',
'strict-transport-security': 'max-age=15780000; includeSubDomains',
server: 'cloudflare' },
config:
{ adapter: [Function: httpAdapter],
transformRequest: [Object],
transformResponse: [Object],
timeout: 20000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers: [Object],
method: 'post',
baseURL: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED',
url: 'https://api.cloudflare.com/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
data: '{"pattern":"","enabled":false}' },
request:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 6,
_maxListeners: undefined,ZONE_NAME_OBFUSCATED
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Object],
connection: [Object],
_header: 'POST /client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters HTTP/1.1\r\nAccept: application/json, text/plain, /\r\nContent-Type: application/json\r\nX-Auth-Email: EMAIL_OBFUSCATED\r\nX-Auth-Key: API_KEY_OBFUSCATED\r\nUser-Agent: axios/0.18.0\r\nContent-Length: 30\r\nHost: api.cloudflare.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'POST',
path: '/client/v4/zones/ZONE_NAME_OBFUSCATED/workers/filters',
_ended: true,
res: [Object],
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Object],
[Symbol(outHeadersKey)]: [Object] },
data: { result: null, success: false, errors: [Array], messages: [] } } }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.