Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
talend-log
Advanced tools
Small wrapper over TraceKit, that allows to inject error reporting as redux-logger middleware
A small library that provides redux-logger middleware for error logging to be applied as errorTransformer.
Exports redux-logger compatible error logging middleware.
your configStore.js file:
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import promise from 'redux-promise-middleware';
import createLogger from 'redux-logger';
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer from './src/errorTransformer';
// important part:
const logger = createLogger({ errorTransformer: initErrorTransformer(LOGGING_SERVER_URL) });
// :end of important part
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware, promise(), logger)(createStore);
export default function configureStore(reducer, initialState) {
const store = createStoreWithMiddleware(reducer, initialState);
// drop a reference to store instance for later use in errorLogging reportMiddleware
TraceKit.store = store;
return store;
}
Look in ./src/errorTransformer.js for jsDoc on each parameter
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer from './src/errorTransformer';
const logger = createLogger({
errorTransformer: initErrorTransformer(
LOGGING_SERVER_URL, {
send: (payload, fetchOptions) => fetch(LOGGING_SERVER_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'@message': payload
}),
...fetchOptions,
}),
payloadMiddleware: payload => Object.assign({
state: TraceKit.store.getState()
}, payload),
fetchOptions: {
headers: {
'Content-Type': 'application/json',
custom: 'customData'
}
},
successHandler: (responseText) => {
alert('yay! ' + responseText)
},
retryCount: 5,
retryTimeout: 3000,
failedTryHandler: function failedTry(error, payload, transportOpts, attempt) {
alert('Oh no! ' + error);
transportOpts.send(transportOpts.payloadMiddleware(payload), transportOpts.fetchOptions, attempt + 1);
},
failedReportHandler: (errorResponse) => {
alert('oh no! ' + errorResponse)
},
}, {
stackTraceLimit: 100,
linesOfContext: 13,
rethrowErrorHandler: () => {},
remoteFetching: true,
collectWindowErrors: true,
}
)
});
Notable details:
If you have some non-critical exceptions that should be reported, but should not break application, then use a possibility to provide handler for better microcontrol:
in your config file:
import LOGGING_SERVER_URL from 'somewhere';
import initErrorTransformer from './src/errorTransformer';
import transportConfig from 'somewhere';
// this:
initErrorTransformer(LOGGING_SERVER_URL, transportConfig, {
rethrowErrorHandler: (e) => { if (e.type === 'critical') { throw e; } else { console.error(e); } },
})
somewhere in your application:
fetch('google.com').catch(errorResponse => TraceKit.report(new Error(errorResponse)));
TraceKit - Cross browser stack traces. https://github.com/csnover/TraceKit
FAQs
Small wrapper over TraceKit, that allows to inject error reporting as redux-logger middleware
The npm package talend-log receives a total of 68 weekly downloads. As such, talend-log popularity was classified as not popular.
We found that talend-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.