You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.
Could you use curl or wget to save the design document to a file and then email it to [email protected]? It seems to be a problem with the way it's been uploaded (it compiles and runs fine for me once I converted \n and \t back to normal).
Env: bigcouch 0.3.1dopsissop
Issue: trying to insert a new doc (that has the validate_doc_update code)
select_
This is console output of the error.
[Thu, 01 Dec 2011 00:37:34 GMT] [info] [<0.102.0>] [--------] couch_proc_manager <0.939.0> died {badarg,
[{erlang,port_command,
[#Port<0.2647>,
[91,
[34,<<"ddoc">>,34],
44,
[34,<<"new">>,34],
44,
[34,<<"_design/app">>,34],
44,
[123,
[34,<<"_id">>,34],
58,
[34,<<"_design/app">>,34],
44,
[34,<<"_rev">>,34],
58,
[34,
<<"1-f34b0e54d9b18462f921eff9329596cb">>,
34],
44,
[34,<<"language">>,34],
58,
[34,<<"javascript">>,34],
44,
[34,<<"views">>,34],
58,
[123,
[34,
<<"getopdCompatibilty">>,
34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc) {\r\n\tif(doc.docType == \"DC\") {\r\n\t\temit(doc.opID, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"getOps">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\nfunction(doc) {\n\tif(doc.docType == 'OP'){\n\t\temit(null,doc);\n\t}\n}"",
125],
44,
[34,<<"isNameExist">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\nfunction(doc) {\n if(doc.name){\n emit([doc.name,doc.docType]);\n }\n}"",
125],
44,
[34,<<"getActiveIOFFs">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc){\r\n\tif(doc.docType == 'OFF' && doc.status == 'A'){\r\n\t\temit(doc.ISSID, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"getIss">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc){\r\n\tif(doc.docType == 'ISS'){\r\n\t\temit(doc.createdAt, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"getIOFFs">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc){\r\n\tif(doc.docType == 'OFF'){\r\n\t\temit(doc.issID, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"getOpsByCode">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\nfunction(doc) {\n\tif(doc.docType == 'OPS'){\n\t\temit(doc.code,doc);\n\t}\n}"",
125],
44,
[34,
<<"getOpsBlackListed">>,
34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc) {\r\n\tif(doc._id == 'blackListedPhoneNumbers') {\r\n\t\tfor(op in doc.numbers) {\r\n\t\t\temit(op, doc.numbers[op]);\r\n\t\t}\r\n\t}\r\n}"",
125],
44,
[34,<<"getActiveIss">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc){\r\n\tif(doc.docType == 'ISS' && doc.status == 'A'){\r\n\t\temit(doc.createdAt, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"getIssMetadata">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction(doc) {\r\n\tif(doc.docType == \"ISS_METADATA\") {\r\n\t\temit(doc.ISSID, doc);\r\n\t}\r\n}"",
125],
44,
[34,<<"isFileExists">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""\r\nfunction (doc) {\r\n if (doc.docType == 'ISS_METADATA' || doc.docType == 'DC') {\r\n if (doc.docType == 'ISS_METADATA') {\r\n emit([doc.ISSID, doc.file.name, doc.version]);\r\n } else {\r\n emit([doc.opID, doc.file.name, doc.version]);\r\n }\r\n }\r\n}"",
125],
44,
[34,<<"getActiveops">>,34],
58,
[123,
[34,<<"map">>,34],
58,
""/* This map view is used to get the list of all ops */\nfunction(doc) {\n\tif(doc.docType == 'op' && doc.status == 'A'){\n\t\temit(null,doc);\n\t}\n}"",
125],
125],
44,
[34,<<"validate_doc_update">>,34],
58,
""function(newDoc, savedDoc, userCtx) {\n function require(test, msg) {\n if(!test) {\n throw({ forbidden: msg });\n }\n }\n\n // Only admins may delete docs.\n if(newDoc._deleted) {\n for(var i in userCtx.roles) {\n if(userCtx.roles[i] === '_admin') {\n //short circuit the rest of the validation\n return;\n }\n }\n\n //because of the above short circuit, if we got this far then it's forbidden\n throw({ forbidden: 'You are not allowed to delete docs.' });\n }\n\n // Check fields that are immutable for all doc types.\n if(savedDoc) {\n require(newDoc.docType === savedDoc.docType, 'You cannot change docType.');\n\n require(newDoc.createdAt === savedDoc.createdAt, 'You cannot change createdAt.');\n }\n \n // Check different fields for different docType values\n switch(newDoc.docType) {\n \n\tcase 'select_OWNER':\n\t\n\t\trequire(\n\t\t newDoc.name,\n\t\t 'Name field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name.length <= 25,\n\t\t 'Name field max length is 25'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.createdAt,\n\t\t 'CreatedAt field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status,\n\t\t 'Status field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status.length === 1,\n\t\t 'Status field max length is 1'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status == 'A' || newDoc.status == 'P',\n\t\t 'SEowner Status should be A || P'\n\t\t);\n\t\t\n\t\tbreak;\n\t\n\tcase 'ISS':\n\t\n\t\trequire(\n\t\t newDoc.code,\n\t\t 'ISS Code field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.code.length <= 12,\n\t\t 'ISS Code max size 12 '\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.type,\n\t\t 'ISS Type field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.type.length <= 8,\n\t\t 'ISS Type max size 8'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name,\n\t\t 'Name field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name.length <= 25,\n\t\t 'Name field max length is 25'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.createdAt,\n\t\t 'CreatedAt field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status,\n\t\t 'Status field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status.length === 1,\n\t\t 'Status field max length is 1'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status == 'A' || newDoc.status == 'P' || newDoc.status == 'I',\n\t\t 'Status should be A || P || I'\n\t\t);\n\t\t\n\t\tbreak;\n\t\t\n\tcase 'OFF':\n\t\t\n\t\trequire(\n\t\t newDoc.type,\n\t\t 'Type field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.type.length <= 12,\n\t\t 'Type field max length is 12'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name,\n\t\t 'Name field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name.length <= 25,\n\t\t 'Name field max length is 25'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.hasCoupon !== undefined,\n\t\t 'HasCoupon field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t (newDoc.hasCoupon === true || newDoc.hasCoupon === false),\n\t\t 'HasCoupon field should be Boolean'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.maxRedemptions,\n\t\t 'MaxRedemptions field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.startsAt,\n\t\t 'StartsAt field required'\n\t\t);\n\t\t\n\t\t//require(\n\t\t //newDoc.endsAt,\n\t\t //'EndsAt field required'\n\t\t//);\n\t\t\n\t\trequire(\n\t\t newDoc.state,\n\t\t 'OFF State field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.state.length <= 16,\n\t\t 'OFF State field max length is 16'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.createdAt,\n\t\t 'CreatedAt field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status,\n\t\t 'Status field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status.length === 1,\n\t\t 'Status field max length is 1'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status == 'A' || newDoc.status == 'P' || newDoc.status == 'I',\n\t\t 'Status should be A || P || I'\n\t\t);\n\t\t\n\t\tbreak;\n\t\t\n\tcase 'op':\n\t\n\t\trequire(\n\t\t newDoc.name,\n\t\t 'Name field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.name.length <= 25,\n\t\t 'Name field max length is 25'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.code,\n\t\t 'Code field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.createdAt,\n\t\t 'CreatedAt field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status,\n\t\t 'Status field required'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status.length === 1,\n\t\t 'Status field max length is 1'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.status == 'A' || newDoc.status == 'P' || newDoc.status == 'I',\n\t\t 'Status should be A || P || I'\n\t\t);\n\t\t\n\t\tbreak;\n\t\t\n\tcase 'ISS_METADATA':\n\t\n\t\trequire(\n\t\t newDoc.ISSID,\n\t\t 'ISSID field is required for ISS metadata'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.file.name,\n\t\t 'FileName is requried for ISS metadata'\n\t\t);\n\t\t\n\t\t//require(\n\t\t //newDoc.fileContent.length <= 4194304,\n\t\t //'Filesize should be not be greater than 4MB'\n\t\t//);\n\t\t\n\t\tbreak;\n\t\t\n\tcase 'd_COMPATIBILITY':\n\t\n\t\trequire(\n\t\t newDoc.opID,\n\t\t 'opID field is required for d compatibility'\n\t\t);\n\t\t\n\t\trequire(\n\t\t newDoc.file.name,\n\t\t 'FileName is requried for d compatibility'\n\t\t);\n\t\t\n\t\t//require(\n\t\t //newDoc.fileContent.length <= 4194304,\n\t\t //'Filesize should be not be greater than 4MB'\n\t\t//);\n\t\t\n\t\tbreak;\n\t\n\tdefault:\n if(newDoc._id != 'listOfSEIDs' && newDoc._id != 'walletTOU' && newDoc._id != 'blackListedPhoneNumbers'){\n\t throw({ forbidden: 'You must provide a valid docType.' });\n\t }\n break;\n }\n \n}"",
44,
[34,<<"couchapp">>,34],
58,
[123,
[34,<<"signatures">>,34],
58,<<"{}">>,44,
[34,<<"objects">>,34],
58,<<"{}">>,44,
[34,<<"manifest">>,34],
58,
[91,
[34,<<"language">>,34],
44,
[34,<<"views/">>,34],
44,
[34,
<<"views/getopBlackListedPhoneNumbers/">>,
34],
44,
[34,
<<"views/getopBlackListedPhoneNumbers/map.js">>,
34],
44,
[34,<<"views/getActiveiss/">>,
34],
44,
[34,
<<"views/getActiveiss/map.js">>,
34],
44,
[34,<<"views/getActiveops/">>,
34],
44,
[34,
<<"views/getActiveops/map.js">>,
34],
44,
[34,<<"views/getIssMetadata/">>,
34],
44,
[34,
<<"views/getIssMetadata/map.js">>,
34],
44,
[34,<<"views/isFileExists/">>,34],
44,
[34,<<"views/isFileExists/map.js">>,
34],
44,
[34,<<"views/isNameExist/">>,34],
44,
[34,<<"views/isNameExist/map.js">>,
34],
44,
[34,
<<"views/getActiveISSOFFs/">>,
34],
44,
[34,
<<"views/getActiveISSOFFs/map.js">>,
34],
44,
[34,<<"views/getIssOFFs/">>,34],
44,
[34,
<<"views/getIssOFFs/map.js">>,
34],
44,
[34,<<"views/getiss/">>,34],
44,
[34,<<"views/getiss/map.js">>,
34],
44,
[34,<<"views/getopByCode/">>,
34],
44,
[34,
<<"views/getopByCode/map.js">>,
34],
44,
[34,<<"views/getops/">>,34],
44,
[34,<<"views/getops/map.js">>,
34],
44,
[34,
<<"views/getopdCompatibilty/">>,
34],
44,
[34,
<<"views/getopdCompatibilty/map.js">>,
34],
44,
[34,<<"validate_doc_update">>,34],
93],
125],
125],
93,10]]},
{couch_os_process,writeline,2},
{couch_os_process,writejson,2},
{couch_os_process,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}
The text was updated successfully, but these errors were encountered: