fix: Remove dicer dependency to libs/utils.js#102
fix: Remove dicer dependency to libs/utils.js#102lahirumaramba wants to merge 1 commit intofastify:masterfrom
libs/utils.js#102Conversation
Eomm
left a comment
There was a problem hiding this comment.
I read the issues, but it is not totally clear to me how this duplication solves the issue.
Is there any bundling process or mocking that breaks the import/require?
| } | ||
| } | ||
|
|
||
| function getLimit (limits, name, defaultLimit) { |
There was a problem hiding this comment.
| function getLimit (limits, name, defaultLimit) { | |
| // This function is duplicated | |
| // Read here for details https://github.com/firebase/firebase-admin-node/issues/1902 | |
| function getLimit (limits, name, defaultLimit) { |
|
@Eomm TextDecoder is not supported by AtlasDB JS runtime. |
|
Ok, I got it, So a try/catch there should solve as well |
|
Lines 110 to 120 in 05c990c |
|
Ah I think a try/catch is definitely a better way to address this. I will make the changes. Thanks for the feedback folks! |
|
Hi team. I am using MongoDB Atlas Serverless functions and following the thread reached this git. Thanks to @lahirumaramba for the fix! I see that the merging is blocked, though. What is the proper way to push the merge, so it reflects on the next library update? Sorry for the lame question. |
Instead of copy-pasting the function, we need to add a try/catch (here details #102 (comment) ) Would you like to send a PR and speed up the process? |
|
Created a new PR #105 |
App Services in Atlas Triggers does not support
util.TextDecoder. As a result usingfirebase-admin(withDicerthrough@fastify/busboy) on Atlas Triggers throws the errors reported in #100 and firebase/firebase-admin-node#1902Looking at the code, it doesn't look like
Dicerhas a direct dependency onTextDecoder. IIUC the dependency toTextDecodercomes fromlibs/utils, which is required indeps/dicer/lib/HeaderParser.jsto access the util functiongetLimit().This PR removes the dependency to
lib/utilsfromdeps/dicer/lib/HeaderParser.jsin turn removing the dependency toTextDecoder.I simply copied the
getLimit()toHeaderParser.js, but a better alternative would be to movegetLimit()to it's own util file and import from there... that way we can keep a single implementation with single set of tests. It also seemed a bit of an overkill so I am proposing this first to see what you think. :)[x]
npm run test[x]
npm run bench:dicerResolves: #100