Uploading a user image doesn't work!, whenever there is relation in upload - strapi

Remote Digital Ocean droplet running ubuntu 20.04 and nginx
4.6 Strapi
UBUNTU 20.04
Default SQL
18.13.0 Node
8.19.3 NPM
I am trying to upload an image that has:
formdata.append(“ref”, “user”);
formdata.append(“refId”, userId);
formdata.append(“field”, “profpic”);
formdata.append(“source”, “users-permissions”);
whenever the field is in the request the upload is failing, if I remove it the upload works but it’s not listed in the correct place that I want it to be.
I’m using strapi’s local upload api
strapiback.com/api/upload
this is what I'm getting in the logs
error: Cannot read properties of undefined (reading 'attributes')
0|api | TypeError: Cannot read properties of undefined (reading 'attributes')
0|api | at /root/strapi/node_modules/#strapi/database/lib/entity-manager/morph-relations.js:11:57
0|api | at Array.filter (<anonymous>)
0|api | at getMorphToManyRowsLinkedToMorphOne (/root/strapi/node_modules/#strapi/database/lib/entity-manager/morph-relations.js:7:8)
0|api | at deleteRelatedMorphOneRelationsAfterMorphToManyUpdate (/root/strapi/node_modules/#strapi/database/lib/entity-manager/morph-relations.js:28:24)
0|api | at Object.attachRelations (/root/strapi/node_modules/#strapi/database/lib/entity-manager/index.js:500:17)
0|api | at Object.create (/root/strapi/node_modules/#strapi/database/lib/entity-manager/index.js:230:20)
0|api | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|api | at async Object.add (/root/strapi/node_modules/#strapi/plugin-upload/server/services/upload.js:363:17)
0|api | at async Promise.all (index 0)
0|api | at async Object.upload (/root/strapi/node_modules/#strapi/plugin-upload/server/services/upload.js:173:23)

I was able to fix this issue
formdata.append('ref', 'plugin::users-permissions.user');
and no need for the source field

Related

Simple Arduino PlatformIO C++11 project has undefined reference to default constructor during linking stage (but intellisense detects no errors)

I've been scouring the internet trying to find a solution and done a ton of tinkering myself, but at this point, I've lost all my hair and feel no closer to solving this problem.
The intellisense in VSCode with Platformio extension is able to auto complete the constructors from /lib/SelectWheel/SelectWheel.h, but it seems like the build linker can't find the header and/or cpp file. Why would the intellisense and build process disagree? How can I fix this?
Here's the error:
Linking .pio\build\megaatmega2560\firmware.elf
C:\Users\matth\AppData\Local\Temp\cclHZ2N6.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_selectWheel':
<artificial>:(.text.startup+0xf6): undefined reference to `SelectWheel::SelectWheel()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\megaatmega2560\firmware.elf] Error 1
Here's the terminal output for pio run -t clean and platformio run --verbose: https://pastebin.com/xn862p00
Here's the project structure:
Hydro9000
| -- .pio
| -- .vscode
| -- include
| | -- Adafruit_BusIO
| | -- Adafruit_EPD
| | -- Adafruit_GFX_Library
| | -- Adafruit_SSD1306
| | -- ArduinoSTL
| -- lib
| | -- SelectWheel
| | | -- SelectWheel.h
| | | -- SelectWheel.cpp
| -- src
| | -- main.cpp
| -- platformio.ini
Here's platformio.ini
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
Here's /src/main.cpp
#include <Arduino.h>
#include "SelectWheel/SelectWheel.h"
SelectWheel* selectWheel = new SelectWheel();
void setup() {}
void loop() {}
Here's /lib/SelectWheel/SelectWheel.h
#ifndef SelectWheel_h
#define SelectWheel_h
#include "Arduino.h"
class SelectWheel {
private:
int pinA, pinB;
public:
SelectWheel();
SelectWheel(int, int);
};
#endif
Here's /lib/SelectWheel/SelectWheel.cpp
#include "SelectWheel.h"
SelectWheel::SelectWheel() {}
SelectWheel::SelectWheel(int pinA, int pinB) {
this->pinA = pinA;
this->pinB = pinB;
pinMode(this->pinA, INPUT);
pinMode(this->pinB, INPUT);
}
Let me know if there is any additional information I can supply to help as I've already tried a bunch of ways to fix this.
I am using...
VSCode v1.47.2
PlatformIO IDE Extension (platformio.platformio-ide) v1.10.0
Microsoft C/C++ Extension (ms-vscode.cpptools) v0.29.0
According to your build log, your file SelectWheel.cpp didn't participate in build process at all (it has not been built). So, add it to build process and make sure it's linked

Gherkin test using table fails with error "Cannot read property 'bold' of undefined"

Using codeceptJs 2.1.1 with Gherkin 5.1.0 french test I'm trying to check all the fields are present in a form using a datable to provide fields name.
Here is the Gherkin test:
#tabletest
Scénario: Les champs
Alors je vois les champs :
| coteComplete |
| typeOptionCote |
Here is the corresponding step:
Then('je vois les champs( de saisie) :', (name) => {
I.say('name', name);
I.seeElement(`input[name=${name}], select[name=${name}], textearea[name=${name}]`);
});
Here is the stack trace:
$ npx codeceptjs run --grep "tabletest" --debug --verbose
CodeceptJS v2.1.1
Using test root "C:\PISTARD\diffusion\dev\pistard-diffusion"
Helpers: Protractor
Plugins: screenshotOnFail, wdio
Recherche par cote #PDIFF-56 --
Emitted | suite.before ([object Object])
» Started SeleniumStandaloneLauncher
» [Session] Starting singleton browser session
Les champs #tabletest
Emitted | test.before ([object Object])
Emitted | hook.start ([object Object])
Emitted | step.before (I am on page "recherche-avancee")
Emitted | step.after (I am on page "recherche-avancee")
Emitted | step.start (I am on page "recherche-avancee")
Etant donné que je suis sur la page "recherche avancee"
I am on page "recherche-avancee"
» Visited http://localhost:4200/recherche-avancee
Emitted | step.passed (I am on page "recherche-avancee")
Emitted | step.finish (I am on page "recherche-avancee")
Emitted | hook.passed ([object Object])
Emitted | test.start ([object Object])
[1] Error | TypeError: Cannot read property 'bold' of undefined
[1] Starting <teardown> session
Emitted | test.failed ([object Object])
Emitted | test.finish ([object Object])
[1] <teardown> Stopping recording promises
» <screenshotOnFail> Test failed, saving screenshot
» Screenshot has been saved to C:\PISTARD\diffusion\dev\pistard-diffusion\codeceptjs-output\Les_champs_1557763592.failed.png
× FAILED in 287ms
[2] Starting recording promises
Emitted | test.after ([object Object])
Emitted | suite.after ([object Object])
-- FAILURES:
1) Recherche par cote #PDIFF-56
Les champs #tabletest:
Cannot read property 'bold' of undefined
ypeError: Cannot read property 'bold' of undefined
at Object.say (node_modules\codeceptjs\lib\output.js:139:53)
at recorder.add (node_modules\codeceptjs\lib\actor.js:40:78)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
FAIL | 0 passed, 1 failed // 5s
Emitted | global.result ([object Object])
Emitted | global.after ([object Object])
» Stopped SeleniumStandaloneLauncher
Using node inspector I was able to see further in the trace.
Add the argument --node-arg=--inspect-brk to tyou command
npx --node-arg=--inspect-brk codeceptjs run --grep "tabletest" --debug
Then open nodejsinspector from your chrome devtools by clicking the node icon:
As for the "bold of undefined" error it
I.say("InputName:" + name);
About the received variables I could see the test in fact receives an object containing the array of values and not actual value. The actual value is accessible like this:
let name = dataTest.rows[0].cells[0].value
so you have to loop manually in the array you receive to get each value and test it
Then('je vois les champs( de saisie)( :)', (dataTest) => {
let name;
dataTest.rows.forEach(element => {
name = element.cells[0].value;
I.seeElement(`input[name=${name}], select[name=${name}], textearea[name=${name}]`);
});
debugger;
});

Laravel Mix - unexpected token error

I am trying to run this
Vue.component(
'async-webpack-example',
() => import('./my-async-component')l
)
I get this error but thought mix could compile ES2015 syntax?
Syntax Error: Unexpected token (30:8)
28 | Vue.component(
29 | 'async-webpack-example',
> 30 | () => import('./my-async-component')
| ^
31 | )
try add System. I think you might be using an earlier release of Webpack 2. System.import() was deprecated in favor of import() in webpack 2.1.0-beta.28.
Change System.import() to import() #2163
Vue.component(
'async-webpack-example',
() => System.import('./my-async-component')l
)

can't get network-id using quantum_network in ansible ad-hoc command, while it works in neutron command

My environment: Ansible 1.7.1/Ubuntu
I have a private OpenStack network, it works correctly if I use the neutron command:
$ env | grep OS_
OS_PASSWORD=cai
OS_AUTH_URL=http://demo-controller:35357/v2.0
OS_USERNAME=larry
OS_TENANT_NAME=demo
$ neutron net-list
+--------------------------------------+---------+--------------------------+
| id | name | subnets |
+--------------------------------------+---------+--------------------------+
| 5ecc0fbb-091b-4c6a-b905-c73e66e1ffda | ext-net | 3aa6539d-24d3-4c06-.. |
| 76506b52-1980-470c-b438-094e8b4bb3e7 | demo-1 | 52cd943d-7f25-4a11-.. |
+--------------------------------------+---------+--------------------------+
Now I want to get the network-id using the quantum_network module:
$ ansible localhost -m quantum_network -a "state=present login_username=larry login_password=cai login_tenant_name=demo name=demo-1 auth_url=http://demo-controller:35357/v2.0/" -v
But that throws an authentication error:
... File \"/usr/lib/python2.7/dist-packages/keystoneclient/utils.py\", line 318, in
inner\n return func(*args, **kwargs)\n File \"/usr/lib/python2.7/dist- packages/keystoneclient/session.py\", line 251, in request\n raise exceptions.from_response(resp, method, url)\nkeystoneclient.apiclient.exceptions.Forbidden: You are not authorized to perform the requested action, admin_required. (HTTP 403)\n",
"parsed": false
What is the problem?
It is the bug in quantum_network module, see issue #7275, it requires admin permission to get tenant id, which is not needed always.
Not sure which ansible release will include this.
I use the commit as patch in my release

SeleniumRC Script error - selenium-browserbot.js

Problem:
In our application, we have same locators(id) for submit images (link + form submit) in Popup and main window. Main window submit image executes two javascript functions for click event. While trying through selenium, I'm getting following selenium error and submit action not happened. Unable to process, even if I clicked manually on the browser, which was opened by Selenium. But this scenario is working fine if I do manually end to end.
I tried with FormSubmit and ClickAt..No luck... Any trick/solution?
I found similar thread without any solution --> Selenium RC - selenium-browserbot.js error (http://stackoverflow.com/questions/2380543/selenium-rc-selenium-browserbot-js-error)
Environment:
Browser: IE8
Java: Sun Microsystems Inc. 16.0-b13
OS: Windows XP 5.1 x86
Selenium RC- selenium-server-1.0.3
Selenium Error Message
An error has occured in the script on this page
Line: 2120
Char: 9
Error: Permission denied
Code: 0
URL: file:///C:/DOCUME~1/script1/LOCALS~1/Temp/customProfileDira540839f44a5460e8f29cdcb8f3632a7/core/scripts/selenium-browserbot.js
Do you want to continue running scripts on this page?
HTML Source
<A onmouseover="imgOn('cmdSubmitbutton', 'submit');" onmouseout="imgOff('cmdSubmitbutton', 'submit');" onclick="return verifyAttachmentJS();submitOrder();" href="javascript:void(0);"><IMG title="Submit this form." border=0 name=cmdSubmitbutton src="/webtop/images/buttons/submit_off.gif"> </A>
selenium RC command history
type(desc1, asdasdas)
click(cmdAttachbutton)
click(cmdSubmitbutton)
click(cmdFinishbutton)
selectWindow(null)
type(ORD_TrackingNbr, 6666)
isElementPresent(cmdSubmitbutton)
clickAt(cmdSubmitbutton, 20,8)
Selenium Log Console
info(1331131785603): Executing: |type | findCnum | ABCDP60 |
info(1331131789088): Executing: |click | gobutton | |
error(1331131792666): Caught an exception attempting to log location; this should get noticed soon!
error(1331131792666): Unexpected Exception: Permission denied
error(1331131792666): Exception details: name -> Error, number -> -2146828218, description -> Permission denied, message -> Permission denied
info(1331131795494): Executing: |selectFrame | relative=up | |
info(1331131796275): Executing: |selectFrame | relative=up | |
info(1331131797056): Executing: |getLocation | | |
info(1331131797494): Executing: |click | xpath=//a[#id="ABCDP60" or #name="ABCDP60" or #href="ABCDP60" or normalize-space(descendant-or-self::text())="ABCDP60" or #href="http://172.18.70.63/webtop/ABCDP60"] | |
error(1331131806338): Caught an exception attempting to log location; this should get noticed soon!
error(1331131806338): Unexpected Exception: Permission denied
error(1331131806338): Exception details: name -> Error, number -> -2146828218, description -> Permission denied, message -> Permission denied
info(1331131808056): Executing: |click | //form[#id='form1']/table/tbody/tr/td[6]/a[4]/font/b | |
info(1331131815478): Executing: |click | cmdZipbutton | |
error(1331131815712): Caught an exception attempting to log location; this should get noticed soon!
error(1331131815712): Unexpected Exception: Permission denied
error(1331131815712): Exception details: name -> Error, number -> -2146828218, description -> Permission denied, message -> Permission denied
info(1331131835384): Executing: |selectWindow | name=attachdoc | |
info(1331131865634): Executing: |type | desc1 | asdasdas |
info(1331131876431): Executing: |click | cmdAttachbutton | |
info(1331131882290): Executing: |click | cmdSubmitbutton | |
info(1331131888290): Executing: |click | cmdFinishbutton | |
info(1331131894196): Executing: |selectWindow | null | |
info(1331131894306): Executing: |type | ORD_TrackingNbr | 6666 |
info(1331131898399): Executing: |isElementPresent | cmdSubmitbutton | |
info(1331131902290): Executing: |clickAt | cmdSubmitbutton | 20,8 |
info(1331132070023): Done appending missed logging messages
error(1331132070023): Caught an exception attempting to log location; this should get noticed soon!
error(1331132070023): Unexpected Exception: Permission denied
error(1331132070039): Exception details: name -> Error, number -> -2146828218, description -> Permission denied, message -> Permission denied
error(1331132115492): Caught an exception attempting to log location; this should get noticed soon!
error(1331132115492): Unexpected Exception: Permission denied
error(1331132115492): Exception details: name -> Error, number -> -2146828218, description -> Permission denied, message -> Permission denied

Resources